Annabeth
Annabeth

Reputation: 11

how to set the path of MODULAR HOME on VS Code?

I'm seemingly new to the VS Code environment and I was tinkering about with Mojo. However, the Mojo extension can't find it's path and I can't understand how to set it. Please help.

I tried going to extensions setting and type { "mojo.modularHomePath": "/absolute/path/to/.modular" } because that's what it says on the details page of the extension. I'm not getting any result.

Upvotes: 1

Views: 2309

Answers (5)

Manoj S Nair
Manoj S Nair

Reputation: 13

In macosx use in your terminal

echo $MODULAR_HOME

it will give you the path that is required to add in the VSCode Mojo Extension settings. Most probably it will be a location like the following, depending on your installation.

/Users/{username}/.modular

Upvotes: 1

mknull
mknull

Reputation: 154

The guys from modular are still polishing rough edges. Currently, they do not detect if you are using bash or ZSH, so this bit has to be done manually.

They already print this on the install screen, but in the case you closed it here is the snippet for bash (add your username):

USERNAME=your_username
BASHRC=$( [ -f "$HOME/.bash_profile" ] && echo "$HOME/.bash_profile" || echo "$HOME/.bashrc" )
echo 'export MODULAR_HOME="/home/$USERNAME/.modular"' >> "$BASHRC"
echo 'export PATH="/home/$USERNAME/.modular/pkg/packages.modular.com_mojo/bin:$PATH"' >> "$BASHRC"
source "$BASHRC"

Then you can verify with

which mojo
/home/your_username/.modular/pkg/packages.modular.com_mojo/bin/mojo

And you can use mojo after restarting VSCode.

Upvotes: 1

user15307498
user15307498

Reputation:

/home/($username)/.modular/pkg/packages.modular.com_mojo

I found it from:

$ modular install mojo

# Found release for https://packages.modular.com/mojo @ 0.5.0
# Installing to /home/($username)/.modular/pkg/packages.modular.com_mojo
# Downloading artifacts. Please wait...

Upvotes: 0

Dou Xu-MSFT
Dou Xu-MSFT

Reputation: 3321

The extension will attempt to find the path of the Mojo SDK installation using the MODULAR_HOME environment variable.

Before installing Mojo extension on VS Code, have you installed Mojo SDK ? If you have not installed Mojo SDK, please install it. Then set the MODULAR_HOME environment in your OS stystem.

ubuntu

export MODULAR_HOME=/path/Mojo SDK installation

If MODULAR_HOME is not set within the environment, the path can be explicitly set via the mojo.modularHomePath extension setting.

mojo.modularHomePath is the path to the MODULAR_HOME containing the Mojo SDK installation.

{
  "mojo.modularHomePath":"/path/Mojo SDK installation."
}

Upvotes: 0

hiro
hiro

Reputation: 21

You must set the MODULAR_HOME. This usually means that "/absolute/path/to/.modular" -> "/home/($username)/.modular"

(Ubuntu case)

Upvotes: 2

Related Questions