Unable to run kotlinc-native command

Viewed 327

I'm trying to run the Kotlin/Native Hello Program but the terminal says the command kotlin-native cannot be found. I'm on a MacBook, using zsh (get same error when I use bash) and installed Kotlin via Homebrew before, so kotlin and it's compiler works on my machine, the kotlinc command works just fine. I'm trying to use the compiler instead of gradle for now. Is there a different command I'm supposed to be using?

2 Answers

It sound like you may have had a similar problem to me. Installing kotlin-native via homebrew did not install the kotlinc-native command.

To get the command working, I had to do the following:

  1. Go to https://github.com/JetBrains/kotlin/releases and get the latest version of Kotlin
  2. Extract it to .kotlin in the home directory
  3. Add export PATH="$HOME/.kotlin/bin:$PATH" to .zshrc

The problem with this method is that it's completely disconnected from Homebrew. You will have to run the steps again every time you want to update Kotlin.

You've typed kotlin-native but the tutorial says kotlinc-native, which is the actual name of the process file.

If kotlinc works then you might just have a typeo.

I don't use these processes directly, but I'm somewhat familiar with them. My guess is check the name.

Related