I am trying to install Azure CLI 2.0 on my mac. I followed official documentation but facing this error.
bash: az: command not found
How can I fix this error on mac?
rather than following this link
https://learn.microsoft.com/en-us/cli/azure/get-started-with-azure-cli
I suggest to install using home-brew on mac. Its simpler
brew update && brew install azure-cli
ref:
https://learn.microsoft.com/en-us/cli/azure/install-azure-cli-macos
I hit the same issue.
Search around for how to create a ".bash_profile" file.
This file usually (always?) exists at /Users/myusername/ folder
Then you will either create this file or edit this file.
Here is a "before" and "after" of my ".bash_profile".
export PATH=$PATH:/Applications/Terraform
export M2_HOME=/Users/shollid3/apache-maven-3.6.0
export PATH=$PATH:$M2_HOME/bin
and after
export PATH=$PATH:/Applications/Terraform
export PATH=$PATH:/usr/local/homebrew/bin
export M2_HOME=/Users/shollid3/apache-maven-3.6.0
export PATH=$PATH:$M2_HOME/bin
Obviously, the addition is
/usr/local/homebrew/bin
Use "where is" to (drum roll) find out where your "az" exists on your computer.
My "paper trail" was:
this below url
https://learn.microsoft.com/en-us/cli/azure/install-azure-cli-macos?view=azure-cli-latest
led me to this below url:
https://docs.brew.sh/Installation.html
and eventually, that is how I got "az" installed to /usr/local/homebrew/bin
But regardless of where you have your "az", you can see how to add/edit bash_profile to get the path pointed to where you "az" is.
Try the following command, or simply close and restart the Terminal session:
exec -l $SHELL
If that does not fix the issue, please share the output of your PATH variable by running
echo $PATH
Related
I hade CompileDaemon working in my golang app before, but it stopped working on my WSL Ubuntu. I tried everything to get it working, and then reinstalled WSL switching to Debian. I am not using docker. I then tried things again and it still says command not found even after installing it two different ways:
go get github.com/githubnemo/CompileDaemon
go: added github.com/fatih/color v1.9.0
go: added github.com/fsnotify/fsnotify v1.4.9
go: added github.com/githubnemo/CompileDaemon v1.4.0
go: added github.com/mattn/go-colorable v0.1.4
go: added github.com/mattn/go-isatty v0.0.11
go: added github.com/radovskyb/watcher v1.0.7
go: added golang.org/x/sys v0.0.0-20191026070338-33540a1f6037
OR
go install -mod=mod github.com/githubnemo/CompileDaemon
Then when I run CompileDaemon --command="./folder_name"
returns:
bash: CompileDaemon: command not found
I face the same issue, here is how I solve it.
It seems that GOPATH is not added to ENVIRONMENT VARIABLE as expected.
vim ~/.zshrc
...
export GOPATH="/Users/YOUR_PROFILE_NAME/go" # set GOPATH
export PATH=$PATH:$GOPATH/bin. # append GOPATH to PATH
don't forget to
source ~/.zshrc
when trying the example of the moq framework, I get the following exception when I enter "go generate":
example.go:5: running "moq": exec: "moq": executable file not found in $PATH
What should I do? I'm using Kubuntu 16.04
PS: I tried
export PATH=$PATH:/home/[...]/go/src/github.com/matryer/moq
without success
#sprabhakaran got the right answer. I only needed to add the go binary folder to the PATH global variable:
export PATH=$PATH:/home/[...]/go/bin
and if it doesn't work, check that moq was correctly installed.
First, install using the following command:
go install github.com/matryer/moq#latest
Go binary should be added to the global PATH
export PATH=$PATH:$HOME/go/bin
worked for me on MAC
I just installed sdkman for installing grails on my machine (MacOS). When I run which sdk command I don't get any output. But when I run the sdk help command the shell is able to resolve it and give the right output. I checked all the directories mentioned in $PATH environment variable but I could not find any executable sdk. So my question is how is shell able to resolve the sdk command?
Note: I also checked in Ubuntu and I see the same behavior.
As you mentioned correctly "sdk" is not a command, its a declared function created by sdkman-main.sh (in ~/.sdkman/src) once called from ~/.sdkman/bin/sdkman-init.sh
This is the reason why the installation page of sdkman asks for appending the following steps in the .bash_profile which declares this function each time the bash profile is loaded :
#THIS MUST BE AT THE END OF THE FILE FOR SDKMAN TO WORK!!!
[[ -s "/home/dudette/.sdkman/bin/sdkman-init.sh" ]] && source "/home/dudette/.sdkman/bin/sdkman-init.sh"
This is also the reason "which" command doesn't pick it up as it checks for the installed commands on the linux PATH
OK. So I found it out. As #that-other-guy mentioned in the comment above, I used type -a instead of which, which showed me that it was a function defined.
I am using linuxbrew to install node. That works well, unless, for the fact that I can only use node after I do the following path export.
export PATH="/home/ericel/.linuxbrew/bin:$PATH"
If I close that terminal and open a new terminal, I will still have to do the same PATh export in order to get my node working.
Is there anyway to fix this permanently?
I do brew doctor, I get the following instructions:
ericel#ericel-X401A:~$ brew doctor
Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry and just ignore them. Thanks!
Warning: /usr/bin occurs before /home/ericel/.linuxbrew/bin
This means that system-provided programs will be used instead of those
provided by Homebrew. The following tools exist at both paths:
xzmore
unlzma
lzcmp
brew
xzegrep
lzgrep
lzdiff
lzless
lzma
pkg-config
xzfgrep
xzdiff
xz
lzfgrep
lzcat
lzegrep
unxz
xzgrep
xzcat
xzless
lzmore
lzmainfo
xzcmp
Consider setting your PATH so that /home/ericel/.linuxbrew/bin
occurs before /usr/bin. Here is a one-liner:
echo 'export PATH="/home/ericel/.linuxbrew/bin:$PATH"' >> ~/.bash_profile
Warning: Homebrew's bin was not found in your PATH.
Consider setting the PATH for example like so
echo 'export PATH="/home/ericel/.linuxbrew/bin:$PATH"' >> ~/.bash_profile
Warning: You have a non-Homebrew 'pkg-config' in your PATH:
/usr/bin/pkg-config
`./configure` may have problems finding brew-installed packages using
this other pkg-config.
Warning: Homebrew's share was not found in your XDG_DATA_DIRS but you have
this variable set to include other locations.
Some programs like `vapigen` may not work correctly.
Consider setting the XDG_DATA_DIRS for example like so
echo 'export XDG_DATA_DIRS="/home/ericel/.linuxbrew/share:$XDG_DATA_DIRS"' >> ~/.bash_profile
But even after doing that, node will work just for that one terminal. I am using ubuntu 16.**
Just had the same error. I think it was, because I installed linuxbrew at first from official page instructions and then i used apt-get.
So I removed the apt-get installation
sudo apt remove linuxbrew-wrapper
and then just added the path to
nano ~/.bashrc
as written in official documentation
echo 'export PATH="$HOME/.linuxbrew/bin:$PATH"' >>~/.bash_profile
then you need to open new terminal for it to take effect.
I've been trying to install npm globally in virtual box with ubuntu 14.04 and Apache 2.4 with various problems with Laravel 5.1
Reading through the docs on npm adn following through these instructions https://docs.npmjs.com/getting-started/fixing-npm-permissions I know I have completed wrecked my $PATH
Previously when I ran echo $PATH I got something like this;
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/games
Now when I echo $PATH I get the following;
/usr/local/bin:/bin
I have managed to stuff everything up on my Laravel install, composer no longer works, php artisan no longer works - am just wondering if anyone is able to help me get back to where I was...
For the novices who may be struggling with this, I got the path, composer, artisan and Laravel functioning by first, replacing the .bashrc with a non corrupt one in terminal from the /etc/skel directory (in local indicated by $)
$cp /etc/skel/.bashrc ~/
Commit changes with
$source ~/.bashrc
Then used the following to export /usr/bin to my PATH - the error for anything attempted in terminal was "The command could not be located because '/usr/bin' is not included in the PATH"
$export PATH="/usr/bin:$PATH"
To permanently commit the changes
$sudo nano /etc/environment
Check the file contains the following
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games"
CTRL & X to save and Y