I'm trying to setup Flutter on my Mac but when I use the terminal to check the version I keep getting the message "zsh: command not found: flutter"
The steps that I've done to set it up are:
In a terminal window type vim ./zshrc
Paste the export PATH="$PATH:[PATH_TO_FLUTTER_GIT_DIRECTORY]/flutter/bin"
code (changing the brackets to the actual file path)
:wq!
Testing the version by typing flutter --version
Is there something I'm missing, or something I'm not doing right?
Your PATH step should likely be:
export PATH="$PATH:[PATH_TO_FLUTTER_GIT_DIRECTORY]/bin"
Note that the directory you want to add to your path is bin, not flutter/bin, relative to the Flutter git directory.
The install instructions for macOS and Linux specify the steps as:
$ git clone https://github.com/flutter/flutter.git
$ export PATH="$PATH:`pwd`/flutter/bin"
Note that the git clone step creates a flutter directory within your current directory, so the path to add is flutter/bin relative to pwd (the current directory).
it can be done with an editor nano or vim which will return a text editor terminal there you can edit path and save,eg
nano .bash_profile
nano .bashrc
Related
I wanted to create a react project and when I executed the command it said zsh: command not found: npx
Then I tried the ls command and it said zsh: command not found: ls.
After setting the export PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin" command both the ls and npx create-react-app command worked fine and when close the terminal and reopen again, the same command not found error shows.
Is there any permenent fix without setting export PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin" command
For adding the variables to the path you need to add it to zshrc file for making that variable available locally.
The way you have used will only work until you use it in the same terminal window path only.
To solve the problem, follow these steps:
Goto you home directory
Simultaneously press cmd + shift + (.) Note:the last key is the key of dot
On following step 2, new hidden files will appear in home directory, look for (.zshrc) file and open it using any text editor.
Add your path variable in it, save and then close it.
Example: export PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
Open terminal and run the command: "echo $PATH" and see if your added variable is present in the output shown by terminal.
If yes, You are now ready to go to use it from anywhere in terminal now.
This is what worked for me on macOS Monterey,
Although I added the path to ./zshrc and sourced the file, after reopening the terminal the PATH was not exported
I followed these steps to solve this
Created .zprofile with touch .zprofile at the home directory. If the file already exists use that.
Add the required path to this file using vim or nano
eg: export PATH=${PATH}:/Users/Development/HashBaze/flutter/bin
If the above two steps don't work try sourcing both the .zprofile and .zshrc after following the above two steps.
This solution worked for me on macOS Monterey version 12.5
I know there are many similar answers to this however I have checked them, watched a video on it and tried countless times. I exported the flutter path to the .bashprofile and it is saved as shown in the screenshot however if I close terminal and try using a flutter command like flutter --version or which flutter or even flutter doctor I get flutter not found or zsh: command not found: flutter
How do I fix this so I can permanently use flutter in any directory or path
Please follow the steps below:
Open the Terminal.
Type: nano ~/.zshrc
Type: export PATH=[PATH_TO_FLUTTER_GIT_DIRECTORY]/flutter/bin:$PATH
Press control+x to Exit
Type: source ~/.zshrc
Restart the Terminal.
Verify by typing flutter --version
You're adding the path to .bash_profile but the error says zsh: command not found: flutter.
Look closely at the error, your default shell is zsh and not bash. So adding the path to .bash_profile doesn't help since the path is being looked up for in .zshrc instead.
Here's how you can add the path to .zshrc instead: https://stackoverflow.com/a/11530176/5066615
Adding FLUTTER PPATH to terminal permanently
Step:1
TYPE: echo $SHELL
This will tell which SHELL you are using (bash or Z shell)
Step:2
TYPE: $HOME/.bashrc
If it shows file does not exists, then you need to create new zshrc file
(Only if the above error accours) TYPE: touch ~/.zshrc // this will create a new zshrc file
Step 3:
TYPE: open $HOME/.zshrc //to open the zshrc file
Add the flutter bin path for setting to the terminal permanently in zshrc file
TYPE: export PATH="$PATH:$HOME/development/flutter/bin"
Step 4:
TYPE: source $HOME/.zshrc //to refresh current terminal window
Now u can run flutter cmds without adding path all times
Whenever I open git bash I get the following warning:
bash: C:/Users/RS3/Anaconda3/etc/profile.d/conda.sh: No such file or directory
The problem is that I uninstalled Anaconda, because I installed independent python, which resulted in giving that error.
How to remove this Warning.
Check the content of ~/.bashrc (which was mentioned here)
Maybe that (or ~/.profile, mentioned here) includes a command for that old uni uninstalled program.
Remove those lines, and try to open again a git bash session.
To remove that warning, simply erase the file path string in the .bashrc file using nano command. Here's how:
Steps to remove that warning:
Open Git Bash and check .bashrc location by typing ~/.bashrc into git bash.
Navigate to folder where .bashrc file is located.
Type nano .bashrc
Erase the string that says C:/Users/RS3/Anaconda3/etc/profile.d/conda.sh
Press ctrl+O to save .bashrc file and then ctrl+X to exit.
When you reopen git bash nothing should appear because .bashrc doesn't have that path in it anymore. Also, if conda commands were working before it will still continue to work after erasing this.
I have followed the following approach in order to install Torch in my machine (Mac).
http://torch.ch/docs/getting-started.html#_
When I am done with the installation, I type:
$ luarocks install image
or $ luarocks lis
or $th
in order to load the th or to make updates on the lua packages. It says "command not found". Do you have any idea how I can resolve this issue?
If you're on a Mac using the bash terminal, make sure that you've permanently added /Users/you/torch/install/bin to your PATH.
To do this:
Navigate in your terminal to the root directory by running the command:
$ cd
Using the text editor of your choice (emacs, vim, etc.) open the .bash_profile file for editing. For example:
$ emacs .bash_profile
Add the following line to the end of the file (replacing 'you' with your Mac username):
PATH=$PATH\:/Users/you/torch/install/bin ; export PATH
Save and exit the text editor
Source the changes by running:
$ source .bash_profile
Check that your PATH has been updated (look for /Users/you/torch/install/bin in the string returned):
$ echo $PATH
To make sure it has been changed permanently, completely quit Terminal, open it and run echo $PATH again
Now try th and it should run Torch!
For more help on PATH:
https://kb.iu.edu/d/acar
The Torch installation (at least for me) added the line . /Users/jb/torch/install/bin/torch-activate to my .profile file, not .bash_profile. I tried adding that exact line to .bash_profile but it didn't work, so based on the recommendations here I got rid of the trailing directory and such.
Have you updated your PATH? It should include something like
/home/user/torch/install/bin
I faced the same issue and following this post deleted and reinstalled everything. However in the end what helped was adding /home/user/torch/install/bin/ to the PATH variable.
I have resolved the issue. I have deleted torch and I have installed it again. I have updated my PATH, and I have ran the $ luarocks install image command. After all of these, I was able to ran $ th command and in general torch.
How do you install Dart so the language can be used within the terminal? (For UNIX based systems, such as a Mac)
After installing Dart (currently located at https://www.dartlang.org/), you will need to do some additional work to use dart commands in the terminal (command line), as it needs to be added to the Bash profile PATHs (on a UNIX based system). To do this, run the following handy command to open the .bash_profile file in it’s default location and with the system’s default text editor touch ~/.bash_profile; open ~/.bash_profile.
Next find the directory that Dart was downloaded to and put the path for dart-sdk/bin inside the .bash_profile as apart of the PATH variable. I.e. a line of code should be added to this file that looks something like this (if you’ve put the dart install in the applications folder on a Mac): export PATH=$PATH:/Applications/Dart/dart-sdk/bin.
To get Bash to start using this new profile immediately without restart, enter source ~/.bash_profile in the terminal (command line), then to double check the PATHs have updated, by enter in the command echo $PATH.
1) Install Dart in your environment (if have not yet)
https://www.dartlang.org/tools/sdk#install
2) Add PATH variable for dart/bin
Example for Ubuntu
# add path example
echo 'export PATH="$PATH:/usr/lib/dart/bin"' >> ~/.bashrc
source .bashrc
or it can be .bash_profile instead of .bashrc
3) And now just run your .dart file with the main() method in the terminal and see an output
$ dart path_to_your_file/your_file_with_main.dart