Flutter command not found and PATH is confusing - flutter

I can't use the Flutter command without it saying zsh: command not found: flutter so I can't create a flutter project which is obviously a necessity.
I have installed Flutter by following the instructions on the site. I set the $PATH how it said to in the docs as well, the first time. I removed flutter from the terminal and reinstalled it but I may have made the situation worse.
Here's what I've done so far:
Put the Flutter SDK in my root folder, I know where it is so that is how I set my $PATH in my .zshrc file export PATH="$PATH:/Users/kentwilson/flutter/bin"
I have run echo $PATH | tr ":" "\n" and this is the result:
/usr/bin
/bin
/usr/sbin
/sbin
/usr/local/bin
/Applications/mongodb-macos-x86_64-4.2.0/bin
/usr/local/share/dotnet
~/.dotnet/tools
Users/kentwilson/Development/flutter/bin
~/flutter/bin
The second from the bottom is from when I had the Flutter installed before.
This is where I am falling apart. I am illiterate when it comes to my computer environment. Everything else I've ever installed required no effort and I miss that.
Decade old MacBook Pro, Catalina 10.15.7 macOS. I know I'm running zsh, I know where the .zshrc is. I have the powerlevel10k installed. Here are my user config lines:
source $ZSH/oh-my-zsh.sh
# User configuration
export MANPATH="/usr/local/man:$MANPATH"
export PATH="$PATH:/Users/kentwilson/flutter/bin"
I've tried it with the double quotes and without. I've tried to find other places that might have a PATH somewhere. Nothing. I've googled a few times and when others simply set the PATH and it fixed the issue but not for me.
Aside from these things, I know nothing. Help me. Thanks.

(Optional)
Find where ~/flutter/bin is added to the PATH and delete the line.
Find where Users/kentwilson/Development/flutter/bin is and delete the line.
You should be able to grep -nr "flutter/bin" * 2> /dev/null from home directory. It might take a while.
(Recommended)
Install FVM https://fvm.app/docs/getting_started/installation
Add following lines to .zshrc
# Flutter
FLUTTER_HOME=$HOME/.fvm/flutter_sdk/
export PATH="$FLUTTER_HOME/bin/cache/dart-sdk:$PATH"
export PATH="$HOME/.pub-cache/bin:$PATH"
export PATH="$HOME/fvm/default/bin:$PATH"
There is a GUI as well for fvm named SideKick which handles multiple flutter versions/channels super easy.

Related

zsh (Default PATH?) messed up with mongodb installation

seems to be imposible after hours and hours trying to solve this problem. All my sudo terminal commands are corrupted due to a several path changes, so i ask for help to set the correct environment variables.
Recently I've a failed installation of mongodb, it was my mistake cause the installation was set for mojave and i've changed several times the path (currently in Big Sur).
The problem starts when i created a .bash_profile in my home user folder, with the mongodb installation path after i moved the files .tgz to /usr/local/mongodb.
After i realized that, i note that when i run sudo 'something' in terminal nothing happens. Instead the name of the window in terminal changes from .zsh to 'sudo' 40x60 and nothing happens. This is very bad for me. Appends all of this i've installed the brand new 11.3.1 big sur update and everything crashes sum the fact that every single file is veryfying...can't at least disable gatekeeper via sudo.
In my user home folder i've:
.bash_profile: - export PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
.zprofile -
#Setting PATH for Python 3.9 #The original version is saved in .zprofile.pysave PATH="/Library/Frameworks/Python.framework/Versions/3.9/bin:${PATH}"
&
.zshrc
with nothing inside, empty lines.
Someone could please provide me the correct paths and commands for each of these files.
I'm only want to have sudo commands again.

Flutter and Dart -> add path on Ubuntu 20.04

I am trying to add flutter to the path but no solution is working for me right now. It was working before when I installed it from snap. Now I am cloning flutter repo into the opt folder and No matter what I try, flutter is not working. I am using ZSH terminal.
So far I have tried:
Adding export PATH=~/opt/flutter/bin:$PATH on last line of .zshrc and .bashrc file.
Running export PATH="$PATH:~/opt/flutter/bin" on the terminal.
And bunch of other tweaks on the keywords but none of the things seems to work.
Try this if you mean you have cloned flutter to /opt folder
export PATH="$PATH:/opt/flutter/bin"
Also if you doesn't mean that and you solely mean ~/opt folder then first verify your flutter installation by typing
~/opt/flutter/bin/flutter
in your terminal,
It should launch flutter it your terminal if not then either your installation is broken or you have to type
chmod +x -R ~/opt/flutter/bin
to make flutter executable if it's not.
PS: Also don't forget to restart your shell if you haven't cause you have to restart you shell after changing something in your .rc files.
I hope I have helped you if not please comment so that I can improve the answer.
This work on Ubuntu.
Add to file .profile the following line:
export PATH="$PATH:/home/your_user_name/opt/flutter/bin

Mac OS: How do you fix a PATH to reach an executable file (in this case postgresql & netlify-cli) without messing up other paths?

In the mac terminal:
Does anyone know how to set the path variables for a Mac OS, without messing up other paths?
Current folder structure:
/
/Applications
/[a lot of applications]
/Postgres.app
/Contents
/Versions
/12
/bin
/psql
/Users
/userName
/Applications
/[nothing, except a couple hidden files]
Right now, if I run the command psql, I am getting:
command not found
If I type the full path:
/Applications/Postgres.app/Contents/Versions/12/bin/psql
it works, but typing this every time is not practical.
If I run git that command is available, or code .
Also, I installed netlify-cli globally with npm install -g netlify-cli, but when I run netlify-cli, I get:
command not found
and I don’t know where to find it in my system
… So, something is working correctly with my paths, and something is not. I don’t know how to fix the problem, without messing up other paths.
Does anyone know how I could find out where netlify-cli got installed and fix my paths to netlify-cli and psql without messing up any other paths?
For Mac OS to be able to find the psql executable, it has to be part of the PATH environment variable, you can check the value of that variable on your terminal with this command
echo $PATH
what you should do is add the psql executable to it, like this:
export PATH=/Applications/Postgres.app/Contents/Versions/12/bin/:$PATH
if that solves your problem, you can put that on your .zshrc or .bashrc to make it persistent

Neovim error: E492: Not an editor command: PlugInstall

OS: Ubuntu 18.04.3 LTS
I just installed neovim using sudo apt-get install neovim and added the folder and file ~/.config/nvim/vim.init. At this moment the file has no content, but when I open up nvim and type :PlugInstall I get error: E492: Not an editor command: PlugInstall. I am clueless, what is going wrong?
I think you are trying to use vim-plug without previously installing it.
I changed my plug#begin to
call plug#begin('~/.local/share/nvim/site/autoload/plug.vim')
and it worked for me now
I followed this and it worked: https://github.com/junegunn/vim-plug/wiki/tutorial
I also wrote call plug#begin('~/.config/nvim/plugged) and made a directory at that location. Then the reload command is also source ~/.config/nvim/init.vim where init.vim is the configuration file. And then I just ran :PlugInstall and it worked :D
I got this error too, but in my case I was typing :pluginstall instead of the case-sensitive :PlugInstall and you have to use the correct case or it won't work. Oddly, :PlugUpdate was able to work before :PlugInstall but that was just because I typed the case correctly.
I see I have the vim.plug correctly installed here
~/.vim/autoload/plug.vim
I also created a "plugged" folder here and I see this is where vim-plug put the downloaded files from running :PlugInstall
.vim/plugged
To be overly pedantic, I typed 'cd' to get to the user directory, then cd .vim to go into my dotted .vim folder, then "mkdir plugged" to create the plugged directory. Not sure if this was 100% necessary or if :PlugInstall would have created it by itself.
I also needed to :source ~/.vimrc between adding addition plug line items and typing :PlugInstall, so make sure you "source" or you can also completely quit and restart your Vim so it will reload your .vimrc file, otherwise it won't know anything about your file edits.
I'm on a Mac. I installed vim-plug for standard vim and this gave me this file
~/.vim/autoload/plug.vim
My .vimrc is this:
" add line numbers
set number
call plug#begin()
" The default plugin directory will be as follows:
" - Vim (Linux/macOS): '~/.vim/plugged'
" Make sure you use single quotes
Plug 'tomasiser/vim-code-dark'
Plug 'tpope/vim-sensible'
call plug#end()
I had the same problem and come here for leave my contribution ( I hadn't find this solution in anywhere ). In my case, it's caused by permissions in my linux. I always start my vim for ocults archives with:
sudo vim .vimrc
In this case, the Vim just use the default commands ( I don't know why but I think this is by the security ). If you just run:
vim .vimrc
All the user commands will be able.
In my case, I had multiple terminal windows open. I still had the Vim window open after installing vim-plug in another window. Solution was to close and re-open Vim.
Instead of
call plug#begin()
I did
call plug#begin(has('nvim') ? stdpath('data') . '/plugged' : '~/.vim/plugged')
Worked 100%
If you have followed the steps in https://github.com/junegunn/vim-plug, but still didn't work.
Try run ':source ~/.config/nvim/vim.init' in vim (not source ~/.config/nvim/vim.init in shell).
Make sure git is installed.
In my case, I was trying to do :PlugInstall in a docker container and did not have git installed. I installed git, and it worked.

how to clear old path for flutter

I was trying to install flutter in MAC, mistakenly I run export path command many times, now when I echo $PATH it shows all paths which I took mistakenly,
question is, can I clear it or there is no issue of it?
The flutter changes your $PATH variable for running by command line. This $PATH variable can sets in a some files. Please, look these file contents for flutter path.
Try to open these files (if exists)
~/.bash_profile or ~/.zshrc (It changes by your terminal shell)
If you find a line like this, you can remove or change the path of flutter.
export PATH="~/flutter/bin:$PATH"