Editing bash profile terminal

Why is there no response in Terminal after editing .profile?

I cannot get a new bash window with command prompts.


When a new Terminal window is opened it shows:

Last login: Sun May 15 11:42:40 on ttys000

Saving session...

...copying shared history...

...saving history...

...completed.


[Process completed]


I am learning to use the Unix commands in Terminal in order to run Python.

iMac with Retina 5K display, OS X El Capitan (10.11.4)

Posted on May 14, 2016 6:58 PM

Reply
3 replies

May 14, 2016 8:40 PM in response to DJWM

Several things.


How did you edit .profile ? If with a GUI editor, then make sure it create a plain text file (an format option in TextEdit if you used that utility). TextWrangler (free <http://www.barebones.com/products/textwrangler/>) is a very good text editor that can be used to edit shell initialization files.

You can also use a command line editor such as 'nano', or 'vim' or 'emacs' vim and emacs are not for the novice user. nano is a easy to use editor for just getting started (but if you are in that situation, I would suggest TextWrangler).

If you accidentally created an RTF or other format file, bash will not process it.

Do you have .bash_profile or .bash_login ?

Bash will look for the following initialization files in the following order and use the first one it finds and stop looking

.bash_profile

.bash_login

.profile


You can rename the existing .profile (or .bash_profile or .bash_login) to a saved name such as save.profile using Terminal -> Shell -> New Command...

User uploaded file

User uploaded file

You can use New Command to get a list of the other . files in your home folder

User uploaded file

Basically you can use the New Command feature to work your way around broken shell initialization scripts.


You may also want to check your Terminal preferences. They should look similar to the following:

User uploaded file

May 14, 2016 8:40 PM in response to BobHarris

Bob, I was using emacs to add a Pythonpath.

The preferences are as in the window you show.

I ran the mv .profile save.profile as you indicated and then /bin/ls -la as a new command and it shows the listing of files in my home directory, including the save.profile.


I do not know what I did wrongly in emacs to cause the problem, but your advice worked, so now a new Terminal window now opens with the correct prompt.

A colleague has also recommended that I not use emacs, so I will look at Textwrangler.

Thanks very much.

David

May 15, 2016 3:20 PM in response to DJWM

I do not know what I did wrongly in emacs to cause the problem

There is a good chance it was not emacs, but rather what changes you made to the .profile, which could have been a misunderstanding of what you were being asked to do, or just bad instructions. I am not a Python user, but looking briefly at a Python docs, I would say it would look something like this:


export PYTHONPATH=/path/to/dir:$PYTHONPATH


There is ONLY 1 space between 'export' and PYTHONPATH, and not other spaces in the 'export' statement.


But I suspect your instructions had you do more than just setting PYTHONPATH, because even a broken export statement should not have caused what you were seeing

A colleague has also recommended that I not use emacs, so I will look at Textwrangler.

TextWrangler is a great app to have in your toolbox. But if you intend to spend a lot of time in a Terminal, you may decide at a later date to use a terminal based editor.


nano is a very simple editor that easy for novice users to start with and for simple edits.


My personal preferences is for the vim editor, it has a steep learning curve, but it is used by a lot of professional Unix programmers. The best way to get started with vim is vimtutor

/usr/bin/vimtutor

Just run vimtutor and follow the instructions.


emacs is a very good editor that a huge segment of the Unix programming world lives in (and I do mean Lives in, as emacs has been described as an operating system disguise as an editor).


Many bits have been killed in editor wars between emacs and vi/vim users. Basically, once you train your fingers to use one of these editors you do not want to switch and you find it strange that anyone would want to use anything except your editor 🙂

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Editing bash profile terminal

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.