Editing the ~/.zshrc file

Viewed 82467

I'm a complete newbie, so I think I'm just missing a step, but have no idea.

I'm following tutorials for Rails. Lots of steps say, "and then editing the ~/.zshrc file." but I don't have any ~/.zshrc file. I'm looking at the folders in Sublime. Also none of the following ~/.zprofile, ~/.zlogin, ~/.zlogout exist. Though, under my home files, there is .zprezto folder. No zshenv either...

Do I just create the files? Seems like they should be downloaded from somewhere. I'm using Terminal with OS X. So lost.

echo 'write whatever' >.zshrc

Thanks in advance!

5 Answers

You will get ~/.zshrc file only when you use zsh shell on your Mac OS. If you're not sure which shell you're using, open terminal and issue the following command.

echo $SHELL

if you get response like /bin/zsh then you're using zsh shell on your Mac. You can edit ~/.zshrc file using vim editor on your Mac which is the default for Mac OS.

to open ~/.zshrc file using vim editor, issue the following command on your terminal.

vim ~/.zshrc

Then you can do any configurations you need. Or else you can use open -t .zshrc command to open ~/.zshrc file from your general TextEdit on Mac OS.

  1. $ open ~/.zshrc
  2. Make changes in the .zshrc file window that opens
  3. Save file
  4. $ source ~/.zshrc

If you are using zsh shell , run the below lines in the terminal:

echo 'setopt PROMPT_CR' >.zshrc

echo 'setopt PROMPT_SP' >.zshrc

echo 'export PROMPT_EOL_MARK=""' >.zshrc

You can edit zshenv instead of zshrc for appending PATH . Please check whether file already exists

cat ~/.zshevn

You can edit file using below command

vi ~/.zshenv

You can refer this to see how to add an entry in PATH

Related