running vs code from the command line on mac

Today was my FIRST in person FRC (FIRST Robotics Challenge) meeting since COVID showed up. Very exciting! Right now the older students are teaching the younger students. Today was an excellent intro the the UNIX/Git Bash command line. Towards the end, they showed that you can type “code” at the Git Bash prompt and have VS Code open automatically. Then a student asked how to do it on Mac.

There’s an easy way to do it and a hard way to do it. I went with the hard way because I thought I knew what to do. If we had gone the easy way, we would have been done in the meeting. Which proves the point of the importance of reading documentation.

The easy way

Courtesy of the setup docs for Mac

  1. Open VS Code (using Spotlight Search/the UI)
  2. Open the command palette (command + shift + p)
  3. Type path
  4. Choose option Shell Command: Install ‘code’ command in PATH┬ácommand.
  5. Close VS Code
  6. Open a new terminal window
  7. Type code

The hard way

I divided the hard way into five steps to explain what to do. We got through step 1 and the beginning of step 2 during the meeting.

The Hard Way – Step 1: Find VS Code

I expected VS Code to be in /Applications. On my computer, it is at /Applications/Visual Studio That was not where the student had it. After some googling and failed attempts at using Stack Overflow threads, we found an excellent tip.

  1. Hold option and click the Apple in the top nav
  2. Choose “System Information”
  3. Software > Applications
  4. Wait patiently. No really. Wait some more
  5. Scroll all the way down to “V” and click “Visual Studio Code”
  6. Read the location. It was under <user home>/wpiilib/vscode or something like that. (WPILive is the robotics library)

The student had the good idea to open it in Finder and drag to /Applications. (Open finder and hold option while choosing “Go”) for extra options.

The Hard Way – Step 2: Figure out where “code” executable is and add to PATH

We poked around in the Visual Studio folder but ran out of meeting time. At home, I tried again; this time using the find command

% pwd
/Applications/Visual Studio
% find . -name code -print

Ok. Then. It’s under Contents/Resources/app./bin/code in side the app directory. I knew it was somewhere in there.

The Hard Way – Step 3: Add to PATH

If you are still on the old shell, add the following line to your <user home>/.bash_profile file. If you’ve switched to zsh, use the .zshrc file instead.

export PATH="$PATH:/Applications/Visual Studio"

The Hard Way – Step 4: Reload the file

Run one of these to run the file you just edited and have your change take effect

source .bash_profile
source .zshrc

The Hard Way – Step 5: Launch VS Code



JCP party online today vs a year ago

Today was the JCP (Java Community Process) party online for the second year in a row due to the pandemic. I found it interesting comparing how I felt about it between the two years. The format was roughly the same – a welcome, a game, chatting.


I felt way more engaged this year. Most of that was due to me. Big group things aren’t that easy to participate in. And last year, I got frustrated more easily. So I got talked over the first few times I tried and gave up. This year, there were either less people or quieter people or I was thinking faster. But it didn’t become a negative feedback loop. And last year because of that negative feedback loop, I felt like I was watching others the whole time.

Paying attention

Way better this year. Working from home all day (and every day) sapped my energy. I didn’t have enough to get through an 8 hour work day let alone enough focus for an after work activity.


Last year wins on convenience. I was home all day last year so I just had to walk a few steps and turn on my personal computer. This year, I had to leave work at 3pm. (Which worked out well because I got a new computer and setting i up at home does work well. Start downloads/installs and walk away. I don’t need to watch Maven “download the internet.”

And yes, I could have worked from home today. I didn’t want to. I’ve worked from home enough for a long time.

Human Interaction

A year ago, my interactions were limited to four families and one neighbor. This meant there were some weeks where I’d see one or human beings. That wasn’t enough. So interacting with people online was a constant reminder of how frustrated I was of the fact. This year, I’m going to the office every day and getting out of my apartment. I’m going places and seeing people again. So while I wish I could have seen some of the party attendees in person, it wasn’t a big deal. Also, I’ve seen a few of them in the past few months in person. (I went to KCDC and the NYJavaSig leaders did a get together.)

Overall feeling

The difference a year makes. This proves that environmental surroundings matter.