0

I've followed these instructions to the letter to move my global npm directory elsewhere, as I was getting permissions issues.

That kinda-worked, but now I can't use npm anywhere unless I input source ~/.profile every time I restart, which is a huge pain.

Is that deliberate? Is there any way around it?

MitchEff
  • 1,417
  • 14
  • 29

3 Answers3

0

Everything in .bash_profile will be sourced on login.

echo . ~/.profile >> ~/.bash_profile
vintnes
  • 2,014
  • 7
  • 16
0

The way around it is to read and understand the section of the Bash manual that deals with start-up files, and then take appropriate action.

In the latest edition of the Bash manual, this seems to be in section 6.2. The version that ships with macOS is probably older, but there has not been much change in this area lately.

My guess would be that you have a ~/.bash_profile file which takes precedence over ~/.profile, but that is just a guess.

Ture Pålsson
  • 6,088
  • 2
  • 12
  • 15
0

Edit: This post has an answer with a nice graphical flow. It might make sense to source in /etc/profile

This link talks about the different startup files of bash. You can source ~/.profile in one of the start up files automatically rather than type it manually as you are now.

Depending on if you want it to source at login or new terminal window put it in ~/.bash_profile or ~/.bashrc

This link has a good breakdown of the different files as well.

noah
  • 2,616
  • 13
  • 27