1

Looks like I have managed to scramble my path variable when installing flutter, and now running yarn, shows zsh: command not found: yarn

This was the command I ran that I started experiencing the zsh command not found: echo 'export PATH="$PATH:[PATH_TO_FLUTTER_GIT_DIRECTORY]/flutter/bin >> ~/.zshrc"

I ran the code solution suggested by @devnull https://stackoverflow.com/a/18428774/1766068

PATH=/bin:/usr/bin:/usr/local/bin:${PATH} export PATH it would work when I open a new tab, but if I should restart the terminal it no longer works.

oguz ismail
  • 1
  • 16
  • 47
  • 69
Dansmog
  • 73
  • 8
  • If you don't get the quoting exactly right, a command like that can really mess things up. Editing the file is generally safer. – Gordon Davisson Apr 26 '20 at 06:18

1 Answers1

2

Open your ~/.zshrc file in a text editor and remove the last line. Then logout and login again.

Tripp Kinetics
  • 5,178
  • 2
  • 23
  • 37
  • Seeing that I couldn't open my .zshrc file, I had to use go through my finder, and in my main, and used CMD+shift. to show all hidden files. ```export PATH="/usr/local/opt/ruby/bin:$PATH" export PATH="/usr/local/lib/ruby/gems/2.7.0/bin:$PATH" export PATH="/Users/squarelabs/Projects/flutter/bin" ``` i removed this ```export PATH="/Users/squarelabs/Projects/flutter/bin"``` and it worked fine. – Dansmog Apr 26 '20 at 06:23
  • 1
    @Dansmog : You need to use a text editor which can easily edit dot-files. From the command line, you can use `nano`. Some editors can be configured to do so (`jEdit`, I think). You can also look [here](https://www.tech-recipes.com/rx/2618/os_x_easily_edit_hidden_configuration_files_with_textedit/). – user1934428 Apr 27 '20 at 07:24
  • On macOS, my favorite GUI editor for things like this is [BBEdit](https://www.barebones.com/products/bbedit/index.html). Even if you don't pay to unlock its full feature set, it's a really good script/config file/etc editor, and knows how to show invisible files in the open dialog. (But get the web-download version, *not* the App Store version -- the App Store version can't invoke your adminly powers to edit system files, due to Apple's security policy.) – Gordon Davisson Apr 28 '20 at 16:29