The Computer Oracle

Where is the .zshrc file on Mac?

Never forget a word again. Memorabit: https://memorab.it

This video is brought to you by Memorabit, an app that sends words, definitions and translations as reminders at unexpected moments, so they stay in memory. Built on cognitive science principles, without AI. Start free on web, iOS and Android:
iOS: https://apps.apple.com/it/app/memorabit/...
Android: https://play.google.com/store/apps/detai...
--------------------------------------------------
Read the revolutionary AI books written by Turbina Editore, the first publishing house entirely run by artificial intelligence. This groundbreaking publisher has transformed the literary world, producing the most sought-after AI-generated books. Start reading today at:
https://turbinaeditore.com/en/
--------------------------------------------------

--------------------------------------------------
Hire the world's top talent on demand or became one of them at Toptal: https://topt.al/25cXVn
and get $2,000 discount on your first invoice
--------------------------------------------------

Take control of your privacy with Proton's trusted, Swiss-based, secure services.
Choose what you need and safeguard your digital life:
Mail: https://go.getproton.me/SH1CU
VPN: https://go.getproton.me/SH1DI
Password Manager: https://go.getproton.me/SH1DJ
Drive: https://go.getproton.me/SH1CT


Music by Eric Matyas
https://www.soundimage.org
Track title: Dreaming in Puzzles

--

Chapters
00:00 Where Is The .Zshrc File On Mac?
00:38 Accepted Answer Score 244
02:28 Answer 2 Score 11
02:57 Answer 3 Score 49
03:37 Answer 4 Score 9
04:06 Thank you

--

Full question
https://superuser.com/questions/886132/w...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#macos #terminal #zsh #themes #iterm2

#avk47



ACCEPTED ANSWER

Score 244


The ~/.zshrc doesn’t exist by default in macOS so you need to create it. The ~/ translates to your user’s home directory and the .zshrc is the ZSH configuration file itself.

So open up a Terminal — or iTerm — window and create that file like this; I am using nano as a text editor but feel free to use whatever text editor you feel comfortable with:

nano ~/.zshrc

And then set the ZSH_THEME value to whatever value you want to use like this:

ZSH_THEME="robbyrussell"

Now to save the file in nano, hit ctrl+X. When it prompts:

Save modified buffer (ANSWERING "No" WILL DESTROY CHANGES) ?

Type “Y” and then you will get a new prompt which looks something like this; note the path /Users/giacomo/ will match your local user’s path:

File Name to Write: /Users/giacomo/.zshrc

Now hit return and the file will be saved and you will now be back to the command line prompt in the Terminal. If you now exit from the Terminal and then open a new window, the ~/.zshrc settings should now be loaded in.




ANSWER 2

Score 49


The .zshrc file is not present by default in macOS Catalina, we need to create it.

Steps for creation:

  1. Open Terminal
  2. Type touch ~/.zshrc to create the respective file. (touch command will create the .zshrc in your current directory but it will be hidden)
  3. Hit Return

To view/open ~/.zshrc you can do either of two things:

  1. Open Finder > Press Cmd+Shift+.

Or:

  1. Open Terminal > and type: open ~/.zshrc



ANSWER 3

Score 11


I am using macOS High Sierra, MacBook Pro.

After I installed a Theme, I also needed to change the ZSH_THEME.

For me, ~/.zshrc was already present in my Home directory, but it was Hidden.

I used Cmd + Shift + . to show the hidden files in Finder, then opened the ~/.zshrc files with my editor. Updated it and saved it. It worked fine.




ANSWER 4

Score 9


"oh-my-zsh" now creates ~/.zshrc automatically now. Immediately afterwards on my OSX Catalina Macbook I executed:

vi ~/.zshrc

And the file was already there; no manual intervention to create it was required on my part.

And directive ZSH_THEME you require was already present:

# Set name of the theme to load --- if set to "random", it will
# load a random theme each time oh-my-zsh is loaded, in which case,
# to know which specific one was loaded, run: echo $RANDOM_THEME
# See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes
ZSH_THEME="robbyrussell"