Appium command not found

I think the next step is to find where this is installed. Can you try this command?

npm root -g

This will tell you where global modules are installed. Then you should be able to find the appium module and executable, and then link it to you ‘/usr/local/bin’ directory.

Additional info:

1 Like

So I found Appium within /Users/chaffe/.npm-global/lib/node_modules, /Users/chaffe/.npm-global/bin is the exact location of Appium and Appium doctor, so why or how does it not recognise it if it recognises npm?

1 Like

Does this command:

which appium-doctor

point to another path? And if you took the output from the which command and did an ls -l on it, does it show as a symbolic link? If so, the output of the ls -l command will start with the letter ‘l’. Might look something like:


At the beginning. If so, then for whatever reason npm failed to create a symbolic link in that path. You can do so yourself to fix it. Come back with the paths from above and I’ll craft you one, or if you’d like to read about them:

so which appium-doctor returns nothing
In regards to ls -l I’m not sure if you mean on npm root -g ls -l this path or another? the response of that is still: /Users/chaffe/.npm-global/lib/node_modules
Which commands should I run to establish the paths necessary?

Most likely you have the global path prefix modified somwehere in .npmrc config. Check

You could either change/reset the prefix or add the current global binaries folder to PATH and use it further.

Two days before I too face the same issue on my windows machine. I am using appium cli and installed using npm i -g appium and no error reported by appium-doctor.

Finally, I uninstalled NodeJS and installed again.

I found (from @wreed) which appears to be the same issue. Attempted ln -fs /Users/chaffe/.npm-packages/lib/node_modules/appium/build/lib/main.js /usr/local/bin/appium and got access denied, then n -fs /Users/chaffe/.npm-packages/lib/node_modules/appium/build/lib/main.js /usr/local/bin/appium chmod +x /usr/local/bin/appium I get ln: /usr/local/bin/appium: No such file or directory

even when I put the files in /usr/local/bin I get the same error

Any other thoughts?

@wreed do you mind helping any further on this?

My apologies. I’ve had to step back from the board as I’ve contracted covid.

However, let me see if I can get you on track. In looking over my machine, I’m realizing that I haven’t asked you how you installed Node/NPM. I’m using NVM (Node Version Manager) so that I can have different versions and switch between them with ease. When I look at my ~/.zshrc, it’s full of references to NVM, and that is how I am seeing ‘appium’ in my $PATH, and how I can call it directly. What is your setup like?

So I don’t have NVM, if I remember correctly I installed homebrew and then downloaded node from their site. When I run nvm -v zsh: command not found: nvm. If I do nano ~/.zshrc I see:

The bin appears to be linked, but I don’t understand how appium or appium doctor falls out of scope.
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
└── [email protected]
If I run npm -v it returns the version, but doesn’t read appium commands.

Ok, can you uncomment the 2nd line in ~/.zshrc, the one that starts with:

# export PATH…

By uncommenting, I mean remove the number sign (#). Then run the command:

source ~/.zshrc

I think your Appium is installed here, can you confirm?


If so, I’d like you to try and link it to /usr/local/bin:

ln -s /Users/chaffe/.npm-global/lib/node_modules/appium/index.js /usr/local/bin/appium

It seems that with Appium 2 (at least on my machine) the file is index.js rather than main.js.

Good luck.

1 Like

@wreed firstly, thank you so much for spending so much time on this with me, you’re a saint and I hope you recover swiftly from Covid and wish you good health.

Secondly, I’m getting access denied on making the link. Do you know a alternative or way around that?
ln: /usr/local/bin/appium: Permission denied

Hmm. I would try ‘sudo’ in that case. Hopefully you have permission to use it.

sudo ln -s /Users/chaffe/.npm-global/lib/node_modules/appium/index.js /usr/local/bin/appium

It should ask for your password and either do it, or it will say that you are not in the sudoers file.

If not in the sudoers file, you can try to install as I have with RVM. Mine is working out of the box. You want to install 14.16.1 Node (rvm install 14.16.1) and then you will want to update RPM (rpm update stable) and then install with rpm (rpm install -g appium). This is how I have installed and I’m having no problems.

What a hero, we now have appium! You might be able to help with this, if you wouldn’t mind… but appium-doctor doesn’t work either. Would sudo ln -s /Users/chaffe/.npm-global/lib/node_modules/appium-doctor/index.js /usr/local/bin/appium-doctor work? Because I tried it and then sourced the changes and zsh: permission denied: appium-doctor which is strange. Or should you link to appium-doctor.js?

Thank you!

On mine the symbolic link is to appium-doctor.js. So yours would be:

sudo ln -s /Users/chaffe/.npm-global/lib/node_modules/appium-doctor/appium-doctor.js /usr/local/bin/appium-doctor

I’m running the command, sourcing the change, but:
which appium-doctor
appium-doctor not found

the response to the link is: ln: /usr/local/bin/appium-doctor: File exists


ls -l /usr/local/bin/appium-doctor

What is that file and why is it there if you can’t call it after adding /usr/local/bin/ to your $PATH (which we did a couple steps past). If it’s a bad link or a problematic file you could delete and then use the ln -s command I gave you above, but before you do that, once more try:


from the command line to make sure that it’s not working.

Running ls -l /usr/local/bin/appium-doctor is returning:
lrwxr-xr-x 1 root wheel 65 10 Nov 10:46 /usr/local/bin/appium-doctor → /Users/chaffe/.npm-global/lib/node_modules/appium-doctor/index.js

You mention it should be linked to appium-doctor.js am I right?
sudo ln -s /Users/chaffe/.npm-global/lib/node_modules/appium-doctor/appium-doctor.js /usr/local/bin/appium-doctor

Running that is returning: ln: /usr/local/bin/appium-doctor: File exists
So the link has been made to the wrong .js file?

appium-doctor still returns: zsh: permission denied: appium-doctor

You must have installed appium-doctor as root. Only the root user or someone in the wheel group (hint: not you) can use this application.

I would try chowning this file. It’s already pointing to the right place. Here is your command:

sudo chown chaffe:staff /usr/local/bin/appium-doctor

Then give the command appium-doctor at the command line.

If that does not work (for whatever reason) then delete the symbolic link:

sudo rm -rf /usr/local/bin/appium-doctor

And then add a new symbolic link:

sudo ln -s /Users/chaffe/.npm-global/lib/node_modules/appium-doctor/appium-doctor.js /usr/local/bin/appium-doctor

@wreed you solved it, thank you for your support on this and your mastery in the cli. I am extremely grateful.