I have installed gomobile at
/Users/GaryChan/go/bin/gomobile
and my project is
/Users/GaryChan/go/src/abc.com/project
When I try to run building android SDK at
/Users/GaryChan/go/src/abc.com/project/sdk
and run :
export ANDROID_HOME=/Users/GaryChan/Library/Android/sdk/ndk-bundle/
gomobile bind -target=android abc.com/project/sdk
I go install go and go mobile but to no avail.
When I execute gomobile at My Mac Terminal, the cmd always prompt -bash: gomobile: command not found
Then I cannot export the SDK. What should I do ?
https://godoc.org/golang.org/x/mobile/cmd/gomobile
Updates :
Go Version is :
go version go1.11.1 darwin/amd64
Make sure /Users/GaryChan/go/bin/ is in your $PATH. If it's not, edit your bash profile to add it. Your profile is a file in your home directory named either .profile or .bash_profile. It should contain a line like this:
export PATH="${PATH}:/Users/GaryChan/go/bin/"
Make this change, then close your Terminal window and open a new one, and you should be able to type gomobile to launch it.
Related
I want to install both flutter v1.22.6 and v2.0.5 on my mac.
currently I have v1.22.6 set up on my mac and have path for it set aswell.
I want a setup where if I enter the command flutter doctor that corresponds to v1.22.6 and when I enter the command flutter2 doctor that corresponds to v2.0.5
I am new to the terminal can someone please help? as of now flutter doctor corresponds to v1.22.6 only. I tried setting a path for flutter2 but that shows as no command found
You need to create alias
Navigate to your home directory:
cd ~
Open up .bash_profile using vi:
vi .bash_profile
or
vim .bash_profile
Add an alias (press i):
alias flutter2="~/place_of_folder/flutter2/bin/flutter"
Save the file (press Escape, type :wq, and hit Enter)
Restart Terminal
FVM (Flutter Version Management)
Using the FVM (Flutter Version Management) would be an optimal solution.
Briefly, FVM is an open-source dependency management tool that helps with referencing a certain Flutter SDK version to be used for a certain project, i.e each project can use a different Flutter SDK version.
Installation
Run the following command:
dart pub global activate fvm
Or, using Homebrew:
brew tap leoafarias/fvm
brew install fvm
Usage
Installing the SKDs:
Basically, you install the latest stable Flutter version by running the following command:
fvm install stable
Or, you could specify the version, as:
fvm install [version_number]
For instance, if you want to have the latest version in addition to 3.0.0, you should run the first command and the second command (as fvm install 3.0.0).
Using SDK for a project:
In the terminal, change the directory to your project, and run the following command:
fvm use stable
stable could be replaced with a specified SDK version. At this point, each project will have its own Flutter SDK based on the used fvm use version number.
However, you could also use the same version for all of your projects by running the following command:
fvm global stable
"How to know which version that I'm using for a certain project?"
In the terminal, change the directory to your project, and run the following command:
fvm doctor
Or, since you are able to run the Flutter commands via the used fvm SDK, you could also run
fvm flutter --version
For more information, you could check the FVM documentaion.
Open Terminal & type: echo $SHELL to check what SHELL you're using,
If you use ZSHELL, not BASH, just 1 step to do this task (if BASH, please flow content of #Adelina in this topic):
Open Terminal and type: nano ~/.zshrc
For me, I'm using 2 versions 2.10.5 & 3.7.x, with ver 2.10.5, I don't need to add alias, default is flutter doctor. And with ver 3.7.x, I just add 1 alias "flutter3" like below:
export PATH="$PATH:/Users/macbookpro/development/flutter/bin"
export JAVA_HOME=$(/usr/libexec/java_home)
export PATH="$PATH:/Users/macbookpro/development/flutterV3/bin"
alias flutter3="/Users/macbookpro/development/flutterV3/bin/flutter"
After add 4 lines above with 2 versions Flutter that you have on Mac, press Ctrl + O, tap Enter to save file ZSHELL, and then press Ctrl + X to close file ZSHELL.
Return to Terminal current session, restart Terminal or restart Mac and type flutter3 doctor or flutter doctor to test
On a macOS High Sierra, I have installed flutter via
git clone https://github.com/flutter/flutter.git
I have add the folder to the path
Configured the system to run all the applications
But I still have the error
flutter command not found
If I try to run it from flutter windows and not from command line, it works fine.
utente-pc:bin itmdev$ ls
cache dart.bat flutter.bat
dart flutter internal
utente-pc:bin itmdev$ flutter
-bash: flutter: command not found
To add entry to macOS PATH variable try this :-
Open Terminal
sudo nano /etc/paths
Paste your flutter path(e.g. /Users/user/Documents/Flutter/flutter/bin)
Save the file and restart the terminal.
I solved this problem by below steps:
Open terminal
Go to your flutter folder
Inside flutter folder run this command pwd
This command will provide you a path. Copy that path
Now run this command export PATH="$PATH:<YOUR COPIED PATH>/bin"
Now run flutter doctor.
I'm getting this error message when try to install aqueduct on macOS Catalina with this command.
pub global activate aqueduct
I managed to install it by putting flutter in front of it but now I cannot run aqueduct. I tried
aqueduct --version
I get an error again
zsh: command not found: aqueduct
Here is my .zshrc file (I've added last second line to try to fix it)
export PATH="$PATH:/Users/peter/development/tools/flutter/bin"
export PATH="$PATH":"$HOME/.pub-cache/bin"
I don't know what else to do...
Edit zshrc file using vim on terminal
vim ~/.zshrc
edit data on zshrc after pressing "i" on keyboard.
Export flutter location, aqueduct location and dart sdk location.
NOTE, to change the your_path to your flutter directory. i.e where flutter is installed.
export PATH="$PATH":"your_path/flutter/bin"
export PATH="$PATH":"your_path/flutter/.pub-cache/bin"
export PATH="$PATH":"your_path/flutter/bin/cache/dart-sdk/bin"
After editing press "esc" key and type :wq for saving
Check working of aqueduct using
aqueduct --version
or
aqueduct serve
If you have flutter installed, try flutter pub global activate aqueduct
I got this error zsh: command not found: pub
quick answer if you already have flutter installed
run
flutter pub get
because You can either download the Dart SDK directly (as described below) or download the Flutter SDK, which (as of Flutter 1.21) includes the full Dart SDK.
In my case I wanted to install dependencies in pubspec.yaml in my dart project, but got zsh: command not found: pub.
What is pub
The pub tool has commands for managing packages and for deploying packages and command-line apps.
Well, I don't know what is aqueduct, but this is a common way to solve such issues:
When you see $ zsh: command not found: aqueduct,
run $ which aqueduct - it shouldn't work.
If it works, then the shell does know about a binary named aqueduct.
Find out in which folder aquedict is located, and add the path to it in export PATH=..., like in you did in .zshrc file.
If you found aquedict binary, and it still fails to work, try adding it permissions to execute:
chmod +rwx aquedict
If you didn't found aquedict binary, read the docs again. :)
In your case it's https://aqueduct.io/docs/getting_started/ ,
and the first step is to install Dart: https://dart.dev/get-dart
I am trying to follow along with the following YouTube video on getting started with Go Debugging.
It recommends following the Delve installation instructions on the official Delve github repo. For Mac users, they are as follows:
Making sure the toolchain is in place
xcode-select --install
xcode-select: error: command line tools are already installed, use "Software Update" to install updates
Using "go get" to install Delve
go get -u github.com/go-delve/delve/cmd/dlv
Making sure developer mode is enabled in Xcode
sudo /usr/sbin/DevToolsSecurity -enable
Developer mode is already enabled.
To check that the installation has been completed correctly, I tried running the following in my Go project directlry:
dlv debug
zsh: command not found: dlv
The author of the video tutorial recommends updating GOPATH and PATH variables in the ~/.bash_profile file in the case that the command is not recognized. I did so so by adding:
export GOPATH=/Users/<user_name>/go/src/
export PATH=$PATH:/Users/<user_name/go/src/my_project
However, even after doing so, I get the same result when trying to run the debugger:
dlv debug
zsh: command not found: dlv
Even if I change the shell for the default zsh to bash, using exec bash, I get the same result.
In order to run an executable, it needs to be available in your PATH.
1. Configure your path.
Make sure that your GOPATH and $GOPATH/bin directories are set correctly in your shell environment. You can do this by adding the following lines to your shell configuration.
~/.zshrc if you're using zsh.
~/.bash_profile if you're using bash.
export GOPATH="$HOME/go"
export PATH="$GOPATH/bin:$PATH"
2. Re-load your shell configuration.
Make sure to either restart your shell or run source on your shell configuration file after the changes:
source ~/.zshrc if you're using zsh.
source ~/.bash_profile if you're using bash.
3. Install the dlv package.
go install github.com/go-delve/delve/cmd/dlv
This is assuming that you're using /Users/<username>/go as your GOPATH.
You should now be able to run dlv from your terminal session.
Good luck!
Set the environment variable GOBIN to be where you want the dlv binary to be installed.
For example:
GOBIN=~/bin go install github.com/go-delve/delve/cmd/dlv
This will install dlv in ~/bin
Clarification
When you run go install, the installation path can be specified by setting the GOBIN environment variable.
There are two ways to set the environment variable:
1) Run export GOBIN=<SOMETHING> before you run go install ..
$ export GOBIN="$HOME/bin"
$ go install github.com/go-delve/delve/cmd/dlv
The export command will alter the environment in the current terminal session. Any later command you execute will see the value you set for GOBIN
When you go with this approach, you usually want to have this environment variable active not only in this session, but all future sessions as well. So it's better to add the line to your bash profile.
2) Set the environment variable only for the command.
$ A=10 some-command
In this case, some-command will see the value of the environment variable A set to '10'. If you run a later command, it will not see this value.
This approach is useful when you are just trying things out, or if you only want to set certain environment variables in certain situations.
The command line I provided as the answer follows this second approach.
It sets the GOBIN variable to the ~/bin directory, and then invokes go install in the same line. This way, this invocation of go install will install dlv in ~/bin
This of course assumes you have a bin directory in your home directory.
If you don't have such directory, then this will not work.
The idea is not to copy paste the line as is. The idea is to change ~/bin to be the directory where you would like the dlv binary to be installed.
I'm trying to install React Native on Mac but I'm not able to get past the first step.
npm install -g expo-cli
This seems to work but when I run the next step expo init AwesomeProject I'm getting this error.
-bash: expo: command not found
I also do not have a .npm-global folder. I'm running npm 6.13.4 on Mac OS X 10.15.2.
This might be a local environment issue.
Your computer should know where to look for the commands you're using, it's likely that your mac is not looking for the correct folder.
In order to expo command works, you must have /Users/yourUser/.npm-global/bin in your $PATH commands.
Open your global bash_profile file vim ~/.bash_profile.
add export PATH=$PATH:~/.npm-global/bin.
Save the changes, and right after in your command line:
source ~/.bash_profile
Now you can try the command again!
Important Note: .bash_profile will run only on login shells. For non-login shells, you would need to create or edit .bashrc with this line above.