Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

How to reset Terminal to initial settings?

Hi all,


I lately have been trying to learn programming through online sources (particularly YouTube). I managed to fiddle around with the terminal application successfully but I am afraid I have done some damage. Since my knowledge of computers is so small, I don't know what I have done. I just know that it is not behaving the way tutorials expect it to.


I would like to reset the Terminal to how it was without me touching it. Is there away to delete my progress and start fresh?


Thanks.

MacBook Air, OS X Mountain Lion (10.8.2)

Posted on Dec 31, 2012 9:05 PM

Reply
18 replies

Aug 1, 2016 12:31 PM in response to WelshDog

There are several ways to do this. Start with this article, and if it does not satisfy your needs, please give feedback with what didn't work, and that might help identify how to adjust the change shell approach

<http://osxdaily.com/2012/03/21/change-shell-mac-os-x/>


Oh yea, you are going for /bin/bash, which is the current OS X shell, and it also happens to be the Linux default shell, so that would be the best choice among the available shells.


Or Google "Mac OS X change shell" which is how I got the above article, but there were more hits. And I know a few of my own tricks, but explaining them is something I need pictures for.

Jun 7, 2017 5:47 AM in response to Arientihon

Arientihon wrote:


I am having this kind of problem when I try to install brew python. I believed it messed up somewhere, and from this I could not do anything else with my terminal. I tried to look up for the file as you mentioned but I could not find it. Please help me restore my terminal as default setting.

Most like messed up your PATH environment variable.


cd $HOME

/bin/ls -lt .profile .bash_profile .bash_login .bashrc


You do NOT need to have any of these files, but chances are you have at least one.


For the ones that you find


/bin/mv .profile saved.profile

/bin/mv .bash_profile saved.bash_profile

/bin/mv .bash_login saved.bash_login

/bin/mv .bashrc saved.bashrc


Quit your Terminal session

Start a new Terminal session


You should have a working PATH environment variable now.


Use a text editor to fix the shell initialization file that is broken

nano filename # from a terminal session

or Textwrangler or BBedit

http://www.barebones.com/products/textwrangler/

if you prefer a GUI based text editor

Oct 26, 2017 7:46 PM in response to Teraisa Goldman

Teraisa Goldman wrote:


```

/bin/mv .profile saved.profile

/bin/mv .bash_profile saved.bash_profile

/bin/mv .bash_login saved.bash_login

/bin/mv .bashrc saved.bashrc

```


Is this how to save your settings to go back to them? Will new files form or add to the older ones with these being saved from that point and back? Thanks!

If any of those files exist, then the 'mv' command will rename them to the save.* name. If any of those files do NOT exist, then you will get an error.


By default NONE of those files exist and ONLY get created by and outside force, where that could be your, or installing some command line utility from some website that provides an installer script.


Here is the order that bash looks for an initialization script

.bash_profile

.bash_login

.profile

The first file found will be used, and all others will be ignored.


By default the .bashrc is ONLY sourced when a subshell is created. But many users include in their .bash_profile (or .bash_login (or .profile))) a source command to run .bashrc when they first login

source $HOME/.bashrc

Jan 1, 2013 6:53 AM in response to joefolino

Linc Davis has provided details of how to reset Terminal.app itself and your login session, if that's what you have changed.


However... Terminal.app, ssh sessions, telnet sessions and some related tools are paths into the Unix underpinnings of OS X, and the Unix command line. There's far more available here to change than just the login settings.


Certainly login settings and user preferences can be changed, and these are per-user. But the whole operating system is also accessable to an administrative user.


If you've made changes to the Unix layer — the operating system settings, and particularly commands involving sudo or su or related commands — there may or may not be a path to restore those settings short of a system reinstallation. You'd need to know all of what was done.


And a caveat with Linc Davis's rm command — be very careful with the rm command. His command is correct and does target the files necessary, but switches or sudo or even spaces in the wrong spot can potentially allow that command to delete great swaths of your files or even your operating system. Put another way, rm is unforgiving. That's why he's added the -i switch on that command, for instance.

Jan 26, 2014 10:53 AM in response to hljiang

I suggest:

-- making a complete backup of you machine.

-- create another userid for messing with terminal/unix.


A book on Bash would be helpful.


Practical Guide to Linux Commands, Editors, and Shell Programming, A (2nd Edition) [Paperback] the book Don't be fooled by the name, the second addition includes Mac OS X.

Advanced Bash Script. premise: Examples for everything. I have revision 6.2.
tldp.org/LDP/abs/abs-guide.pdf


BASH Programming - Introduction HOW-TO
http://tldp.org/HOWTO/Bash-Prog-Intro-HOWTO.html#toc14


Apple administrative commands
http://manuals.info.apple.com/en_US/IntroCommandLine_v10.6.pdf


Apple Shell Scripting Primer
https://developer.apple.com/library/mac/documentation/OpenSource/Conceptual/Shel lScripting/ShellScripting.pdf


Check you local library. Any book on Bash syntax will do. There will be minor differences but they will not be great.


Sometimes you can get a good deal on used books in Amazon.


--------------------------------------------------------------


<p><span style="font-size: 12pt;"><strong>Create new Account</strong></span></p>

<p> </p>

<p>blue apple &gt; system preferences </p>

<p> clicks on accounts icon</p>

<p> </p>

<p>click on lock icon if locked. </p>

<p>enter logon password </p>

<p><img alt="Picture 9.png" class="jive-image-thumbnail jive-image" src="https://discussions.apple.com/content/attachment/207776040" width="450" __jive_id="207776" /></p>

<p> </p>

<p>click on + icon ( left side of screen just above the lock icon )</p>

<p> </p>

<p><img alt="Picture 10.png" class="jive-image-thumbnail jive-image" src="https://discussions.apple.com/content/attachment/207777040" width="450" __jive_id="207777" /></p>

<p> </p>

<p>after creating new account, you need to logout of your current account.</p>

<p> </p>

<p>blue apple &gt; log out ... current count name ...</p>

<p> </p>

<p>log on to new account. see if problem goes away.</p>

<p><img alt="Picture 11.png" class="jive-image" src="https://discussions.apple.com/content/attachment/207859040" __jive_id="207859" /></p>

<p> </p>

<p>if it has gone away, some preference file got messed up on your account. Rename the appropriate Preference file. You will have to figure out the name. They are .plist files. Look for these files in Preferences folder which is in your Library folder [ more formally ~/Library/Preferences ]. ... reboot.</p>

<p>Post back for more help. </p>

<p> </p>

<p> More tips on creating a new account</p>

<p> http://pondini.org/OSX/Transfer.html </p>

Jul 12, 2016 10:14 PM in response to Linc Davis

Hello Linc Davis,


You seem to be extremely knowlegeable.


When I first bought my mid 2012 macbook pro I started stupidly fiddling with terminal because I wanted to run Windows with Virtual Box ( I know! ). I followed a tutorial online without thinking too much of it.


http://phaq.phunsites.net/2011/03/05/sharing-windows-7-between-boot-camp-and-vir tualbox/


I mainly used the following commands described there.


diskutil umount /Volumes/BOOTCAMP

To have this settings parmenently applied to the system, you will need to add them to the local boot script. For this purpose, we use the “nano” command, a simple text editor which is simpler to use then “vi”. Just type and quit using the “CTRL-X” key stroke.
Chances are that this file does not yet exist, but never mind, it’ll be created automatically.


sudo nano /etc/rc.local

Add the following text to your rc.local file:


# grant VirtualBox permissions to Boot Camp partition
#
chmod 777 /dev/disk0s3
diskutil umount /Volumes/BOOTCAMP



I don't think these did too much harm except that everytime I start the machine the drive unmounts and mounts again.


I am now going to update my HDD to a SDD, so would like a clean slate.


I also tried using your rm command line but I didn't get a result. I was in my user folder when I typed it. Was I in the wrong folder?


Can you help?

Jul 14, 2016 5:48 PM in response to cpalvetzian

cpalvetzian wrote:


my terminal is doing this when i insert that bit of text

"

Christians-Mac-Pro:desktop christian$ rm -i ~/.profile ~-.bash

-bash: rm: command not found

Christians-Mac-Pro:desktop christian$



"

please help i cant do anything with my computer (wont let me install homebrew or ruby on rail)


Thanks.

You have a bad 'PATH' environment variable.

You can use /bin/rm to delete .profile

Aug 1, 2016 11:40 AM in response to Linc Davis

I use Terminal very infrequently. My Terminal line looks like this: [MiXXXXXXig-3:~] jeXXXXXXi%

(I altered the names for security.) I'm pretty sure I changed something in Terminal a long time ago and now it always appears this way and I don't think that is always what I want. The -3 at the end of the hard drive is incorrect but just appeared on it's own. How can I get the path changed to root or at least the lowest level of the hard drive? I do have a root account. Thanks

Aug 1, 2016 12:03 PM in response to WelshDog

You are running the csh, or the tcsh shell.


Most users are running the bash shell by default.


However, the first few releases of Mac OS X back in the early 2000's had csh as the default shell, and anyone that has been just upgrading their operating system since them, and/or transferring the old disk to the new Mac since those days will still have csh as their shell.


The first name is your system name, and that is obtained from the operating system. Generally having a -n following the system name is because when the Mac booted up, it thought it saw other systems on the local network with the same name.


This generally happens if there are several Bonjour Proxy servers operating on your home network. AppleTV, Airport Extreme, Airport Express, and Time Capsules are devices that will provide Bonjour Proxy services. You should check that they all have the latest firmware upgrades.


If you want change your shell from csh to bash, that is a different question. As you said you do not use your Terminal much, it may not be worth changing it at this time, unless you are confused by instructions you read on the web not working because they were written for the bash shell, and the csh shell does not behave exactly the same.

Aug 1, 2016 12:12 PM in response to BobHarris

"As you said you do not use your Terminal much, it may not be worth changing it at this time, unless you are confused by instructions you read on the web not working because they were written for the bash shell, and the csh shell does not behave exactly the same."


Yes that would be a good reason for me to change it to bash. My UNIX/Linux skills are pretty non-existant and mostly are just me cutting and pasting things I find useful into Terminal. I am careful and typically deconstruct any command I find into it's parts to understand what it will do before I execute.

How to reset Terminal to initial settings?

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