No symlink in zsh with venv

The problem:

Unable to symlink '/Library/Frameworks/Python.framework/Versions/3.8/bin/python3' to '/Users/mcadams/Documents/ ... /env/bin/python3'

This is, I think, an issue with the new Z shell (zsh) in MacOS Catalina. What I had attempted was my usual virtualenv command, at the bash prompt:

python3 -m venv env

That gave me the “Unable to symlink” pain. So I opened my .zshrc file with nano and added this line:

export PATH="/usr/local/opt/python/libexec/bin:/usr/local/bin:$PATH"


So then I changed the command to:

python3.8 -m venv env

And it worked. source env/bin/activate and I was in my new env, just like normal.

If you aren’t sure which Python 3 version you’ve got, type: python3 --version and you’ll find out. Note again, this is MacOS, not Windows.

Changing the prompt in zsh

In Mac OS 10.15 Catalina and later, the default shell in Terminal is zsh instead of bash. This is fine. All I wanted to do was change the command prompt in zsh. This is not difficult, but it was damned hard to find out exactly how to do it without installing a theme and using Homebrew and a thousand other things I didn’t want to do.

So here’s how to just change the prompt and nothing else.

The default prompt in zsh is like this:

mcadams@Mindys-MacBook-Air ~ %

What I like is to keep my username (mcadams), get rid of the machine name (Mindys-MacBook-Air), and add the name of the current directory. So if I’m in Documents/python/scraping, I want the prompt to look like this:

mcadams scraping %

Note that the % sign is the prompt character in zsh, not $ as in bash.

First, you might like to play around with the prompt you want by just testing things before you write your final choice into the .zshrc file. If you do write it into the file and you don’t like it, you can change it later.

This article was a big help to me: Customizing the zsh Prompt.

To test out the modified prompt shown above, in Terminal, type or paste this:

PROMPT='%n %1d %# '

If you’d rather have the dollar sign instead of the percent sign, try this:

PROMPT='%n %1d $ '

If you’d like to make the zsh prompt a different color:

PROMPT='%F{yellow}%n %1d $ %f'

There’s a limited list of color words we can use, but 256 colors are available by number. Just change the word yellow to a number from the “Xterm Number” column there.

Once you’ve hit on a prompt you love, you need to add it to the .zshrc file in your user directory. The file might not exist yet. That’s okay. First, make sure you’re in your user directory and not elsewhere:


Press Return. Then type:

nano .zshrc

You’re in the nano text editor now. Copy and paste or type the line that makes the prompt you desire, such as:

PROMPT='%F{yellow}%n %1d $ %f'

If there’s already something in the file, just add that line at the bottom. Then, two steps:

  1. Control O (that’s an uppercase letter O) to write out the changes.
  2. Control X to quit nano.

You will not see the new prompt until you open a new Terminal window.

I also found this longer article helpful: Zsh (Z shell on MacOS).