Failed to localise android-ndk installed from homebrew - macos

I have installed SDK doing brew cask install android-ndk and NDK doing brew cask install android-ndk, everything was ok during the installation and inserted the PATH, like this:
export GRADLE_HOME=/usr/local/opt/gradle
export ANDROID_HOME=/usr/local/Caskroom/android-sdk/3859397
export ANDROID_NDK_HOME=/usr/local/Caskroom/android-ndk/16b/android-ndk-r16b
export ANDROID_SDK_ROOT=/usr/local/Caskroom/android-sdk/3859397
export PATH=$GRADLE_HOME/bin:$PATH
export PATH=$ANDROID_HOME/platform-tools:$PATH
export PATH=$ANDROID_HOME/tools:$PATH
Saved and committed doing source ~/.bash_profile.
After, I tried to run my gradle task, during start of compile of a C++ library, I got this:
* What went wrong:
A problem occurred configuring project ':some-library'.
> NDK not configured.
Download it with SDK manager.
Is there any way to solve it?
Thank you.

In macOS installed with brew use this the following paths
In file ~/.bash_profile
export ANDROID_NDK_HOME = /usr/local/share/android-ndk
export ANDROID_HOME = /usr/local/share/android-sdk
If you are using another bash script or zsh for example, you should put it begin of that script file, eg.
myortherscript.sh
#!/bin/bash
# THIS AT TOP
source ~/.bash_profile
Important: This sample I'm considering the same user for configuration bash_profile and script execution.

Related

Cannot get spark/pyspark working on macOS Mojave

Have a new MacBook w/ macOS Mojave but cannot get spark/pyspark working. I have done the following:
Downloaded the latest Apache Spark from https://spark.apache.org/downloads.html
Unzipped it in my home directory (/Users/myname/)
Renamed the folder spark
Checked in the Finder window that spark was there, and the folder contained python, bin, and bin/spark-shell subfolders
Got the ability to pip install packages with: curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py >> python get-pip.py in the terminal >> Checked that it was installed by doing import pip in the python shell >> sudo easy_install pip in the regular terminal
pip install pyspark, which worked
Created both a .bashrc and .bash_profile files in the Users/myname/ path
I tried the following versions of the commands in these bash files:
export SPARK_HOME="/Users/myname/spark/python"
export PATH="$SPARK_HOME/bin:$PATH"
export SPARK_HOME=/Users/myname/spark/python
export PATH=$SPARK_HOME/bin:$PATH
export SPARK_HOME=/Users/myname/spark
export PATH=$SPARK_HOME/bin:$PATH
export SPARK_HOME=~/spark
export PATH=$SPARK_HOME/bin:$PATH
Different installation articles say I should just be able to do pyspark in the terminal, or spark/bin/spark-shell or just 'bin/spark-shell`, I just keep getting versions of the message
-bash: pyspark: command not found
Any advice?
If you've installed pyspark from pip, you don't need the standalone installation. You just need to fix you env vars. First, find the location of your site packages:
python -c "import site; print(site.getsitepackages())"
This is probably something like this /usr/lib/pythonX.Y/site-packages
Then, add the exports to your bash profile and source it.
echo "export SPARK_HOME=/usr/lib/pythonX.Y/site-packages/pyspark" >> ~/.bash_profile
echo "export PATH=$SPARK_HOME/bin:$PATH" >> ~/.bash_profile
source ~/.bash_profile

need to manually create symlinks every time i install something

For example, I'm trying to install pipenv using the following commands:
$ pip3 install --user pipenv
$ cd ~/Documents/myproject
$ pipenv install requests
zsh: command not found: pipenv
It seems that the issue can be resolved if I run sudo ln -s ~/.local/bin/pipenv /usr/bin. Is this a safe thing to do? I've also been having this issue with several other packages, like tensorboard and xflux. Is there something wrong with my system that makes it such that I need to manually create a symlink every time? How can I change things so that packages can install normally without me having to do this every time?
The problem you are having is that the tools you are installing are being installed in non-standard locations and are not being included in your PATH. One way to resolve this would be to include the paths in your PATH environment variable. In order for these programs to be in your path every time you login, do this (assuming you are using zsh as your shell):
1) Open ~/.zshrc using vim or any other editor:
vim ~/.zshrc
2) Append the following to this file:
export PATH=$PATH:/path/to/dir/containing/pipenv
Remember to replace /path/to/dir/containing/pipenv with the appropriate path.
3) Source your ~/.zshrc so that the path is included in your current session:
source ~/.zshrc
4) Now everytime you login, the paths should be available in your environment and you won't need to create symlinks.

command not found after go build

I have install and setup go.
export GOPATH=$HOME/go
export PATH=$PATH:/usr/local/go/bin
I have created a package at following location.
$HOME/go/src/github.com/shamsher31/gosymbol
I build inside package folder using
go build
It creates binary in bin folder inside GOPATH
But when I try to run package name from command line it gives following error.
symbol: command not found
How can I execute binary from command line ?
You need following configuration for ubuntu.
$ sudo gedit ~/.bashrc
Add the following config
export PATH=$PATH:/usr/local/go/bin
export GOPATH=$HOME/go;
export PATH=$PATH:$GOPATH/bin;
/usr/local/go/bin will be your go installation path and
$GOPATH/bin will be where your custom build packages will get installed.
I was having a similar problem on OSX, I found this the easiest way to get golang up and running:
With HomeBrew:
brew install go
Then add these to your .bash_profile:
export PATH=$PATH:$GOPATH/bin
export GOPATH=$HOME/.go
For Go latest version go1.13.7 and above
If you have installed Go in its default location, then you no need to set up the GOROOT path.
The default location for Unix or macOS is /usr/local/go and for Windows - c:\Go.
You can verify the path using the command go env.
Note: If you are the getting the same error "command not found", then you need to unset GOROOT.
If you want to set up Go in the preferred location, then you need to export the GOROOT path like this:
export GOROOT="/your/preferred/location"
and
export PATH="$PATH:$GOROOT/bin"
in .bashrc or .bash_profile file.
i was the same problem in mac but i'm using zsh
I was able to solve the problem by editing the file ~/.zsh
export PATH=$PATH:/usr/local/go/bin
export GOPATH=$HOME/go;
export PATH=$PATH:$GOPATH/bin;
for mac
example I put custom go folder in workspace directory. you could change my custom go directory workspace by your own.
add the following script to .bashrc
export GOROOT="/usr/local/go"
export GOPATH="$HOME/workspace/go"
export PATH="$HOME/workspace/go/bin:$PATH"
then run source .bashrc on your terminal
as icza said
go build leaves the executable in the current working directory.
Maybe help add ./ to you run command.
go build
./symbol
On Windows:
Set $GOPATH env, e.g., $HOME/go
Add $GOPATH/bin into $PATH
It should work now.

Git and Terminal Commands not Working in Mavericks

I have two problems:
Git is not working although it is installed. Mavericks pops up a window and suggests to install Xcode (I don't want to): "The 'git' command requires the command line developer tools. Would you like to install it now?"
Sometimes even basic commands such as "ls" don't work. "-bash: ls: command not found". However, after inserting the command " . /etc/profile" it works for a while.
My ~/.bash_profile:
export PATH=/usr/local/git/bin:$PATH
export PATH=/usr/local/mongodb/bin
### Added by the Heroku Toolbelt
export PATH="/usr/local/heroku/bin:$PATH"
I'm very new to this. Please be aware while helping out.;) Your help is highly appreciated.
Amir
You are overwriting your PATH in this line:
export PATH=/usr/local/mongodb/bin
it should be:
export PATH=/usr/local/mongodb/bin:$PATH
Then if you are using OSX I strongly suggest that you use Homebrew http://brew.sh/ which is a package manager (like linux) for mac.
If you are developing on Mac, the command line tools are (almost) required for C/C++/ObjC dev. You can download them without XCode but it is not recommended. Homebrew will need them to build the software for your platform.
To download them go to https://developer.apple.com/downloads/index.action
Note, you'll need a developer account (it is free)
Once you have installed homebrew it is easy to have access to the latest software e.g:
brew install git
brew install mongodb
etc.
You don't have to manage and download the packages by hand. Very handy !
export PATH=/usr/local/git/bin:$PATH
export PATH=/usr/local/mongodb/bin
That second export overwrites PATH completely and sets it to the mongodb directory only. You need to append (or prepend) to PATH, not overwrite it.
export PATH="/usr/local/git/bin:$PATH"
export PATH="/usr/local/mongodb/bin:$PATH"
...

call macports svn rather than pre-installed mac's svn

i have mac preinstalled svn at ->/usr/bin/svn
i have macport install svn at -->opt/local/var/macports/software/subversion/1.6.3_0/opt/local
my .bash_profile look like
export M2_HOME=/Users/teoh/work/maven
export M2=$M2_HOME/bin
export PATH=$M2:$PATH
export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Home
export PATH=/Users/teoh/work/gwt-mac-1.5.3:$PATH
how to set macport svn as default svn each time i use the console in mac? what do i need to put in .bash_profile?
The default install of Macports install links into /opt/local/bin and /opt/local/sbin.
So adding:
export PATH=/opt/local/bin:/opt/local/sbin:$PATH
at the end of your .bash_profile should let you access MacPorts svn.
I would also like to add that it is odd that MacPorts didn't do this for you when you installed it. Check for the line similar to above in your .bash_profile. If you have a line like it then try moving it to a position lower in the file.
You can also use 'which svn' in bash to determine which copy of subversion you are using.
In your .bash_profile file you can put:
alias svn=/opt/local/var/macports/software/subversion/1.6.3_0/opt/local/bin/svn
you need to set the macport svn location on the path before the preinstalled svn location.

Resources