This question already has answers here:
How to set .bash_profile, if it does not exist yet. I want to launch sublime from a command line in Mac
(4 answers)
Closed 3 years ago.
I'm having a very hard time installing flutter when I opened my terminal and tried to open the bash profile and I entered open -e .bash_profile on the therminal, I get error stating that my .bash_profile does not exit please see below, can someone help me I been researching and trying to figured what's wrong and no one seems to have an answer.
Last login: Sun Apr 28 00:06:05 on console
Veasnas-MacBook-Pro:~ veasnamam$ open -e .bash_profile
The file /Users/veasnamam/.bash_profile does not exist.
Veasnas-MacBook-Pro:~ veasnamam$
You easily can create a new, empty .bash_profile by doing a touch ~/.bash_profile.
Afterwards run open -e .bash_profile again.
In my case (MacBook Pro too) the file .bash_profile exists, but is empty (I'm using ZSH anyhow) so don't worry if yours does not exist.
Related
This question already has answers here:
Should aliases go in .bashrc or .bash_profile? [duplicate]
(4 answers)
Closed 4 years ago.
im setting up a new alias by typing this command:
vi ~/.bashrc
and then placing my alias:
alias school='ssh -Y username#linux.student.cs.uwaterloo.ca'
followed by exiting the file using: wq
however when i close my terminal and open my terminal, i get a "command can't be found." error message.
if i type source ~/.bash_aliases, it will work, the alias will work, but when i open a new terminal it won't.
is my .bashrc supposed to be empty when i vi into it?
The reason your alias is getting lost is because you dont have your bashrc sourced in a new terminal.
Same will happen even if you create a new alias file and source it in bashrc because its scope gets limited to the terminal you are editing in.
What you can do is logout once and then log in back so that bashrc entries gets updated for your user account or you can source in each terminal by typing
source ~/.bashrc
By adding the same entry to '''.profile''' you are making sure the alias is set on each system boot.
So its better to set the alias in .bashrc rather than .profile
Another major point to nite here is to make sure you dont delete anything in bashrc since that will do catastrophic changes to you session.
This question already has answers here:
Bash script prints "Command Not Found" on empty lines
(17 answers)
Closed 4 years ago.
I have setup react-native in my system.
I have mac OS X El Capitan.
After completing setup of react native, whenever i open my terminal and type command ls then, it shows "command not found".
export PATH="/usr/bin:/bin:/usr/sbin:/sbin"
export PATH="/usr/local/bin:/usr/local/sbin:$PATH"
After executing above two lines in my terminal, everything works fine. ls command is working after that. But once i close my terminal and again open it, ls command stops working and it shows "command not found".
I have also tried to add above two lines in .bash_profile file, but didn't get success. I don't know how to get rid of this issue.
Add following line to you .bash_profile
export PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin
Simply you can do it by following command
echo "export PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin" >> ~/.bash_profile
After that please restart your terminal
This question already has an answer here:
How to restore .bash_profile on a mac? None of my unix terminal are working [closed]
(1 answer)
Closed 7 years ago.
I tried fixing an unrelated problem by changing my path in my .bash_profile, but I think I messed up and now my terminal cant find any command, not even 'ls' or 'nano'. Is there any way to edit the bash profile file back to the original without using the command line? Is there a way I could find my bash profile in finder and edit it with the text app? Or do I have to factory wipe my MacBook?
okay yeah I fixed it by changing my setting PATH=/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:/usr/bin:/bin:/usr/sbin:/sbin and that gave me the bash commands back and then I could use nano to edit the profile back to how it was before I messed with it. I feel really dumb.
This question already has answers here:
Error message on Terminal launch [duplicate]
(2 answers)
Closed 6 years ago.
Every time I open Terminal in CentOS 6.4, I get the error:
bash: usr/local/bin: No such file or directory
I've checked .bashrc and .bash_profile to see if there are any lines that reference usr/local/bin, but haven't found anything. The same error also appears when I switch to root, or run a shell script.
Is it as simple as adding a backslash in front of usr? Like so--
/usr/local/bin
Still don't know where the error is happening though. Any help is much appreciated. Thanks!
This is strange as the normal bash directory on a centos 6.4 system is /bin/bash, however I would advise you to check the following:
echo $SHELL
It should pull your SHELL environment variable to show you where what shell you are using, normally it looks like this:
SHELL=/bin/bash
If it's different say for example:
SHELL=usr/local/bin/bash
then I would check your passwd file to make sure your users default shell is pointing to the right place.
username:x:601:601::/home/username:/bin/bash
Also I would suggest check where you shell actually lives
which bash
/bin/bash
And make sure everything is pointing to the correct location.
This question already has an answer here:
How to restore .bash_profile on a mac? None of my unix terminal are working [closed]
(1 answer)
Closed 8 months ago.
Whenever I start a new Terminal session, the window opens up with a command:
'-bash: cd: /Users/yourusername/Library/lejos_nxj: No such file or directory'.
I want to remove that line from coming up on the prompt, so I deleted the Terminal plist file and sent hard resets, but nothing has worked for me so far.
Is there anything I haven't tried yet?
You've probably got something in your ~/.profile, which is automatically executed when you open a Terminal.
If you did not set anything in there, do
rm ~/.profile
in a Terminal and this should disappear.
If you think that something important may be in there, do
open -a TextEdit ~/.profile
(or change TextEdit to your preferred editor) to view and edit the file.
That line is probably in either your ~/.bashrc file or your ~/.profile file. I would check those two files first (and they are both hidden because of the period initial character).
Edit: I just checked my OS X system, and I don't have ~/.bashrc (but you may).
You could try a terminal replacement (Just recently read about this one, iTerm2) it might
resolve your problem by using its own default startup settings.
If it is anything like Linux the ~/.bashrc and ~/.profile are used when you open your terminal.
It seems that most people assume it is in some init file but its not clear which are included. Once your shell does come up (ignore errors) -try this:
script
bash -l -x
exit
exit
Now you should have a file called typescript which will have debug info showing most if not all of what the shell has executed when coming up in login mode. You could for instance do grep source typescript to see which files were involved OR you could find refrences to nxj etc.
p.s. I assume your clearing of the plist would clear the preferences, but wouldn't hurt to see if the relevant command is in 'Terminal-> Presences->Settings->Shell->Run Command' for any of the terminal window presets