So I'm installing some things for coding and personal usage, and I need to run this in the terminal (I'm on Mac if you didn't read the title).
~/.bash_profile
It just says permission denied, Im running OSX 10.8.4 Mountain Lion. How do I bypass this?
Go the users home directory. Check if the bash_profile is visible there or not. If not, press Command + Shift + . and bash_profile will be visible.
View an installed configuration profile On your Mac, choose Apple menu > System Preferences, then click Profiles . If you haven't installed any configuration profiles, Profiles preferences isn't available. Select a profile in the Profiles list to view information about it.
###Text Editor Method: Open up Terminal and enter in open -e . bash_profile . This will open your profile in a simple text editor.
How to Manage Your .bash_profile In macOS 1 Create .bash_profile. Open the terminal. 2 Edit .bash_profile. If the bash_profile is large, then it becomes difficult to edit in the terminal itself. So we can... 3 Delete .bash_profile. To delete bash_profile, go to the finder app in macOS. Go the users home directory. Check if the... More ...
To create the bash_profile, proceed with the following steps: 1 Open the terminal. 2 Move the home directory using the following command: cd ~/ 3 Use the touch command to create the bash_profile as follows: touch .bash_profile
However, if you want to source it to run automatically when terminal starts instead of running it every time you open terminal, you might add . ~/.bash_profile to ~/.bashrc file. When you open a terminal, the terminal starts bash in (non-login) interactive mode, which means it will source ~/.bashrc.
Many users simply launch a new shell or open a new terminal window, but there is no need to do that, there’s a way to directly refresh the profile in use thanks to the source command. Reloading and refreshing other command line shell profiles, tcsh, fish, etc is just a matter of pointing source at the initialization script like so:
On MacOS: add source ~/.bash_profile
to the end of ~/.zshrc
. Then this profile will be in effect when you open zsh.
You would never want to run that, but you may want to source it.
. ~/.bash_profile source ~/.bash_profile
both should work. But this is an odd request, because that file should be sourced automatically when you start bash, unless you're explicitly starting it non-interactively. From the man page:
When bash is invoked as an interactive login shell, or as a non-interactive shell with the --login option, it first reads and executes commands from the file /etc/profile, if that file exists. After reading that file, it looks for ~/.bash_profile, ~/.bash_login, and ~/.profile, in that order, and reads and executes commands from the first one that exists and is readable. The --noprofile option may be used when the shell is started to inhibit this behavior.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With