Dart PATH does not change even after changing it in .bash_profile
Thanks for all the comments.
All I had to do was brew uninstall dart
Which will uninstall the one in /usr/local/bin/dart
Then after that when I do which dart
it shows:
/Users/ME/development/flutter/bin/cache/dart-sdk/bin/dart
Problem solved.
Hope this helps someone who has the same problem.
UPDATE
I just found it today that I can also change dart path by changing the path in /etc/paths.d/dart
file. But it needs admin access, so do sudo nano /etc/paths.d/dart
Comments
-
Zenko over 1 year
I have added the
PATH
in.bash_profile
like this:export PATH="$PATH:/Users/ME/development/flutter/bin/cache/dart-sdk/bin"
and then have restarted my Mac but then when I do
which flutter dart
, it still show:/Users/ME/development/flutter/bin/flutter /usr/local/bin/dart
According to the article in flutter official site here, it is better to have dart at the same folder as Flutter. Excerpt from the article:
As shown above, the two commands don’t come from the same bin directory. Update your path to use commands from /path-to-flutter-sdk/bin before commands from /usr/local/bin (in this case). After updating your shell for the change to take effect, running the which or where command again should show that the flutter and dart commands now come from the same directory.
Thank you
-
Jamaluddin Rumi over 3 yearsyou saved me 😀