.profile not working from terminal in mac
Asked Answered
W

6

28

I had a .profile file that I was reading and using aliases from in my terminal, but at some point the aliases stopped working for no clear reason (other commands were still working).

Thinking to make a quick fix, I deleted (rm) and recreated my .profile file in my user directory. There are no bash_profiles or others in existence that I can see, at leasts in that directory.

The new .profile did not work. I tried restarting the terminal and the computer.

Now, the commands that worked in the original .profile are still run although I cannot find the file, and the new .profile gives:

No such file or directory(last half of a filename sourced here) and: command not found messages

The .profile file only contains path updates, aliases, and files to source. Trying to source the .profile file also gives the error messages above.

However, typing in the path updates, aliases, and files to source directly into the terminal by copying them from the .profile file works fine.

Help?

Westcott answered 3/11, 2013 at 23:0 Comment(2)
Have you checked the aliases?Ligetti
I have essentially the same problem. However, I definitely do NOT have any .bash_profile or .bash-login (or .login) file. Moreover, if I manually execute source ~/.profile in Terminal, then the aliases defined in ~/.profile do take effect.Bonnibelle
B
39

Perhaps you have a .bash_profile or .bash-login file in your home directory and it's being read in preference to your .profile settings?

Take a look here: How to make OS X to read .bash_profile not .profile file

Balk answered 3/11, 2013 at 23:7 Comment(3)
For me, it was indeed because an SDK I recently installed (for Google Cloud, actually) created its own .bash_profile, which overrode my .profile. So I moved my .profile stuff into .bash_profile.Vaulting
Same with me, but for this time it was the SenchaCmd installer (6.0.0.x) which also creates a ~/.bash_profile file without asking me or maybe even looking if there's an alternative file like .profile already existing yet... sigh.Torytoryism
See also: #18773551Primrose
F
6

Try this

echo "source ~/.profile" >> .bash_profile
Federal answered 24/1, 2017 at 4:36 Comment(0)
L
4

I encountered this problem today on a coworkers machine, I solved it by simply creating a symbolic link for my .profile:

ln -s ~/.profile ~/.zprofile
Linter answered 7/9, 2018 at 14:49 Comment(1)
i'm using bash so I had to do quite the same with ln -s ~/.profile ~/.bash_profileTrochelminth
S
4

For me, there were no .bash_profile or .bash-login files either. The problem I found was OZH. OZH using .zshrc, adding "source ~/.profile" in that file solved my problem.

Sixth answered 21/5, 2019 at 10:22 Comment(0)
C
1

For me, there were no .bash_profile or .bash-login files, but the .profile was still not being loaded. The issue turned out to be that the owner of the .profile was root, instead of the current local user. Using chown fixed the issue.

Circumstantiate answered 28/11, 2017 at 20:45 Comment(0)
B
1

I installed Android studio and some development tools and it added an empty .bash_profile file in my home directory. rm ~/.bash_profile solved the problem, just make sure that there is nothing you need in it.

.bash_profile is a hidden file so try to run it and it would tell you if it exists or not.

Becker answered 21/8, 2018 at 14:20 Comment(1)
Cleanest solution if you do not wish to use bash-specific commands.Inattentive

© 2022 - 2024 — McMap. All rights reserved.