Bash Profile in macOS

MD Aminul Islam Jan 30, 2023
  1. Create the .bash_profile
  2. Edit the .bash_profile
  3. Delete the .bash_profile
Bash Profile in macOS

In this article, we’re going to discuss how we can create, delete, and edit the bash profile in macOS.

Create the .bash_profile

To create a .bash_profile, open the terminal and move to your home directory with the below command.

cd ~/

Now you can create the .bash_profile by using the following command.

touch .bash_profile

Edit the .bash_profile

Now, let’s edit the .bash_profile. We can edit this file inside the terminal.

To do this, we need to execute the following command.

vi ~/.bash_profile

If the .bash_profile is large, it may become open in a default mode to edit in the terminal. Here we can use TextEdit for this purpose.

First, open a text editor like TextEdit, open the file and move to your home directory. If the file is hidden, then unhide the file by pressing the command + shift + .

You can use the below line of code to open the .bash_profile with the text editor TextEdit.

open -a TextEdit.app ~/.bash_profile

Delete the .bash_profile

To delete the .bash_profile, open the finder app in macOS and go to the home directory. If the file is hidden, then unhide the file.

Afterward, select the bash profile and press the command + delete to delete the file.

Please note that all the methods discussed here focus on the macOS environment.

MD Aminul Islam avatar MD Aminul Islam avatar

Aminul Is an Expert Technical Writer and Full-Stack Developer. He has hands-on working experience on numerous Developer Platforms and SAAS startups. He is highly skilled in numerous Programming languages and Frameworks. He can write professional technical articles like Reviews, Programming, Documentation, SOP, User manual, Whitepaper, etc.

LinkedIn

Related Article - Bash Profile