Heroku command not found - heroku

After installing Heroku Toolbelt, in terminal on Mac when trying to run the following command:
heroku
I get the error:
bash: heroku: command not found
When I do:
gem environment
I get:
- RUBYGEMS VERSION: 1.3.6
- RUBY VERSION: 1.8.7 (2012-02-08 patchlevel 358) [universal-darwin11.0]
- INSTALLATION DIRECTORY: /Library/Ruby/Gems/1.8
- RUBY EXECUTABLE: /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
- EXECUTABLE DIRECTORY: /usr/bin
- RUBYGEMS PLATFORMS:
- ruby
- universal-darwin-11
- GEM PATHS:
- /Library/Ruby/Gems/1.8
- /Users/Bart/.gem/ruby/1.8
- /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :benchmark => false
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- http://rubygems.org/
I've tried adding several paths to $PATH, but nothing works...

Manually adding the symlink after installing Toolbelt fixed it for me.
sudo ln -s /usr/local/heroku/bin/heroku /usr/bin/heroku

(This answer is for typical other persons, that may land here, and that may find it useful)
If you come to install heroku snap using snap command through the command line as follow
sudo snap install heroku --classic (the thing you will find in the heroku doc).
And that after installation the heroku command isn't available. Then here the solution and the why:
First know that when you install a new snap, it get added to /snap folder. A new folder with the snap name is created (/snap/heroku), and the executable file for the command is added to /snap/bin (/snap/bin/heroku).
Try
/snap/bin/heroku help
and you will find it work very well.
Solution: So you have just to add /snap/bin to your PATH environement variable.
Heroku is supposing that it's already done. I don't know, if that should have been done automatically at the installation of snapd package. But any way, that's it.
For how to add new paths to the PATH environment variable look at the links bellow, to get a good idea (case you don't know that already):
https://stackoverflow.com/a/26962251/7668448
https://askubuntu.com/questions/866161/setting-path-variable-in-etc-environment-vs-profile
https://www.computerhope.com/issues/ch001647.htm
https://hackprogramming.com/2-ways-to-permanently-set-path-variable-in-ubuntu/
http://www.troubleshooters.com/linux/prepostpath.htm
https://serverfault.com/questions/166383/how-set-path-for-all-users-in-debian
Here links about why you need to logout and login back or reboot
Setting environment variable globally without restarting Ubuntu
https://superuser.com/questions/339617/how-to-reload-etc-environment-without-rebooting
Here an example:
sudo nano /etc/environment
i chose to add the path through /etc/environment (remember you can't use shell commands).
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/node-v9.6.1-linux-x64/bin:/snap/bin
You can see i add it at the end (that simple).
Reboot your computer or logout and login back (PAM script handle the construction of the PATH from /etc/environment at session creation time)
If You want to have the effect take place right away, execute:
source /etc/environment && export PATH
(it affect only the current opened shell and the children processes)
Here another example doing it in /etc/profile:
if [ "`id -u`" -eq 0 ]; then
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
else
PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games"
fi
PATH="$PATH:/snap/bin"
export PATH
I just added one line (the one before the last, and note that a portion from the whole file (/etc/profile)).
Reboot or logout and login back.
Execute :
source /etc/profile
to be operational right away (affect the current shell and the children processes).
There is different ways to add to PATH, even an infinity of ways if we give our imagination a go. The difference between the ways is about when it get set, and executed, and what scope it reach. As also organization aspect (i can have my own text list (one path per line), and have it compiled and executed in the right manner and place for example). Better see the links above, i put a good selection out there, to get a better understanding about how things work, and what method to choose. But generally the two above for a system wide configuration, are mostly what you need.

Do remember to actually source the installation file.
wget -0- wget https://toolbelt.heroku.com/install-ubuntu.sh | sh
didn't work for me. And as a linux noob I used instead:
wget 0- wget https://toolbelt.heroku.com/install-ubuntu.sh | sh
notice that the '-' is missing from the option to wget. This downloaded the install source to my current directory.
then I did:
bash install-ubuntu.sh
which finished up the installation for me.
then:
heroku login
works!!

Just run
$ gem install heroku
Form your app that's it.

I am using zsh which didn't have snap in its path. So just add this in ~/.zshrc.
export PATH=$PATH:/snap/bin

try npm install -g heroku for any platform.

Ran gem install heroku first and it gave me the following message:
heroku must be installed from cli.heroku.com. This gem is no longer available. (RuntimeError)
Steps from Heroku:
brew tap heroku/brew && brew install heroku
or Ubuntu
sudo snap install --classic heroku

when you install heroku in linux as per the documentation using
sudo snap install heroku --classic
it will install heroku inside /snap/bin/heroku
but when you type the command in terminal it will look into /usr/bin/ directory,
a simple solution is to create a symlink by
sudo ln -s /snap/bin/heroku /usr/bin/heroku
after that you can just run the heroku command in terminal.

First install heroku:
wget -qO- https://toolbelt.heroku.com/install.sh | bash
After that add a symlink to binary like #Garrett did:
sudo ln -s /usr/local/heroku/bin/heroku /usr/bin/heroku

Export snap Directory
export PATH=$PATH:/snap/bin

For yarn
If you want to deploy your backend or server, go to backend or server folder, use -
yarn global add heroku
For deploying frontend or client, go to frontend or client folder and use the same cmd.
For npm
Go to the respective folder which you want to deploy and use npm i -g heroku

After installing Heroku Toolbelt using the .pkg file I downloaded from Heroku's Getting Started with Rails 4.x on Heroku page, I got the heroku command not found message. My /usr/local/heroku/bin folder did exist.
I was able to resolve this issue by going to https://toolbelt.heroku.com and downloading the same .pkg file from that site and re-installing it. Note, I did not uninstall the previous package first.

After you run wget -0- wget https://toolbelt.heroku.com/install-ubuntu.sh | sh you might get the following warning:
WARNING: The following packages cannot be authenticated!
heroku heroku-toolbelt
If this happens, run this apt-get install -y --force-yes heroku-toolbelt
I've run all the commands with sudo, but I don't know if it makes a difference. Thanks to this answer

Brew install did not work in macOS?
For me brew tap heroku/brew && brew install heroku did not work in macOS.
So I tried the standalone download.
Here is the command which worked for me
curl https://cli-assets.heroku.com/install.sh | sh

Related

Getting a "don't have write permissions" when installing cocoapod

I'm trying to put a google sign in for my ios app and to do that I need CocoaPods. But when installing it like there own website on terminal I get this:
$ sudo gem install cocoapods
[Password: (*Put in my admin password for my macbook*)
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /usr/bin directory.
This is being done on a Macbook Air running High Sierra 10.13.2
(Don't know if you need that info but I've never done anything with cocoapods or ruby before)
I also tried following this link and followed the awnser and installed RVM, or at least I think I did. I just put this in:
ruby -e "$(curl -fsSL
https://raw.githubusercontent.com/Homebrew/install/master/install)"
Well I tried installing CocoaPods after that but still got the same thing.
You might try the following command
sudo gem install cocoapods -n /usr/local/bin
The problem is that gem install was trying to use /usr/bin for installing the binaries, which shouldn't be touched for the System Integrity Protection. Since:
A centerpiece is the protection of system-owned files and directories
against modifications by processes without a specific "entitlement",
even when executed by the root user or a user with root privileges
(sudo)
Sudo is without any power in this situation.
Hence the solution uses -n, from gem help install it says:
-n, --bindir DIR Directory where binary files are located
in this way you will be able to move the binaries in a more comfortable destination: /usr/local/bin which stands for programs that a normal user may run.

Heroku CLI suddenly broken

Suddenly, from one command to the next, the Heroic CLI stopped working. No matter what I type into the command line, I get the same error. See below.
$heroku help
▸ commands is not a heroku command.
▸ Perhaps you meant domains
▸ Run heroku help for a list of available commands.
! error getting commands pid 24643 exit 127
What the heck is going on?
this problem just happened with me after the last update of heroku CLI,
heroku CLI check if there is updates after execute any command related with and when run updates the problem occurs because is not working with root permissions.
to fix this you need to reinstall heroku CLI
sudo apt-get remove heroku
sudo add-apt-repository "deb https://cli-assets.heroku.com/branches/stable/apt ./"
curl -fL https://cli-assets.heroku.com/apt/release.key | sudo apt-key add -
sudo apt-get update
sudo apt-get install heroku
and you probably need to add this path
PATH=$PATH:~/usr/bin
export PATH
This just happened to me. I fixed it by removing the heroku app the same way i installed it. I had the gem installed, so i uninstalled that.
gem uninstall heroku
Then i used homebrew to reinstall it.
brew install heroku
and it worked.
Something similar (although with a different error message) happened to me after updating my OS. On a Mac, make sure to install the CommandLineTools (with Xcode) after a major OS update!

Fastlane command not found

I am trying to install fastlane. I have Xcode installed. I installed fastlane using the command sudo gem install fastlane. I now go into my project folder and type fastlane init and get the error:
-bash: fastlane: command not found.
I see that fastlane is installed and can see it here
/Users/username/.gem/ruby/2.0.0/gems/fastlane-1.70.0/bin
on my Mac.
I tried adding this to my PATH, but I still get the same error. My path is
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:./Users/username/.gem/ruby/2.0.0/gems/
What am I missing here?
Add the following line to your bash profile:
export PATH="$HOME/.fastlane/bin:$PATH"
You can either close the terminal session and restart it or run source ~/.bash_profile to load your configuration and then you can go so you start using fastlane 🚀
I got run into similar issue last week. I installed fastlane using homebrew on mac, but it was showing the same error.
I tried installing it using Ruby and it worked like a charm. Here is the command.
sudo gem install fastlane -NV
Also seems like you have not installed command line tools for xcode.
Install them using xcode-select --install
I met this issue because of installing zsh, the below two steps solve my problem:
open ~/.zshrc
save path
2.1 if you install fastlane with Homebrew
Copy export PATH="$HOME/.fastlane/bin:$PATH" on the bottom line.
2.2 if you install fastlane with RubyGems
Copy export PATH="/usr/local/bin/fastlane"" on the bottom line.
save upon file and try fastlane init, everything is OK!
In the terminal type cd ~/ to go to your home folder
Type touch .bash_profile to create your new empty file
Type open -e .bash_profile to open the file
Enter export PATH="$HOME/.fastlane/bin:$PATH" and save
Restart terminal (not sure needed?)
Here is what I installed on Mac - from scratch
Removed from brew install
brew uninstall fastlane
brew install rbenv
Install Ruby version 2.6.6
rbenv install 2.6.6
Set the Ruby version in global
rbenv global 2.6.6
Add Ruby to the PATH
if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi
Install bundler
gem install bundler
Install fastlane
bundle add fastlane
fastlane is in cask now. You can install it using
brew cask install fastlane
Now you need to export PATH so that your shell can find fastlane
do
export PATH="$HOME/.fastlane/bin:$PATH"
If that doesn't work, try this
export PATH="$HOME/.fastlane/bin/fastlane_lib:$PATH"
Make sure you add it to ~/.profile, ~/.zshrc or ~/.bashrc for future
If you are working on local machine then add following to you .bash_profile
export PATH="$HOME/.fastlane/bin:$PATH"
If you are working on Jenkins then this worked for me 😎
Under Jenkins -> Manage Jenkins -> Configure System -> Global properties -> Environment variables I added:
Name: Path
Value: /bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
Reference
brew install ruby
brew install fastlane
Warning: fastlane 2.145.0 is already installed, it's just not linked
You can use brew link fastlane to link this version.
brew link fastlane
cd iOS
fastlane init
I have got the same issue on mac 10.11, after a lot of struggling I found that the problem in installing unf_ext 0.0.7.2 gem
I have done the following from this answer
brew install coreutils
After that try reinstall fastlane again it should work again
I faced this issue in Fedora 30 i followed these steps:-
1-installed all dev tools using these commands
sudo dnf install #development-tools
sudo dnf install #rpm-development-tools
2- run sudo gem install fastlane -NV
Fastlane worked like a charm
hope it helped
I managed to install following way
Install ruby
sudo apt install ruby ruby-dev
Add following to top of your "~/.profile" file
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
Check of any errors with source ~/.profile command. If there is not output means all is good.
Install Build essentials
sudo apt-get update
sudo apt-get install build-essential
Fastlane depends on Google API Clint lets install that first
sudo gem install google-api-client
Install Fastlane
sudo gem install fastlane -NV
Check your installation
fastlane -v
Credits: This and this article helped me.
Flutter and Github Actions for Android:
If you are setting up Github Actions for a Flutter project for android and run into this error in one of your steps, see the work flow below:
jobs:
release:
runs-on: ubuntu-latest
env:
LC_ALL: en_US.UTF-8
LANG: en_US.UTF-8
steps:
- uses: actions/checkout#v3
- name: Set up ruby
uses: ruby/setup-ruby#v1
- name: Setup Fastlane
working-directory: ./android # <-- Make sure you have this
run: bundle install
- name: Run Fastlane
working-directory: ./android. # <-- Make sure you have this
run: bundle exec fastlane android [lane name].
Make sure to setup the ruby/setup-ruby#v1 action correctly depending on your project. see the doc: https://github.com/ruby/setup-ruby
In my case I have not specified the ruby version because I am using the .ruby-version file in my project.
DO NOT INSTALL FASTLANE GLOBALLY
It is recommended that you use a Gemfile to define your dependency on Fastlane. This will clearly define the used Fastlane version, and its dependencies, and will also speed up using Fastlane.
Step 1: Install bundler using
sudo gem install bundler
so any time you wan run Fastlane
bundler exec fastlane ...
You can add fastlane path environment by add line
export PATH="$HOME/.fastlane/bin:$PATH"
to ~/.bash_profile or ~/.zsh_profile file (if you use zsh shell).
And final start new terminal session or reload using command source ~/.bash_profile or source ~/.zsh_profile (if you use zsh shell)
First,You need to check if you have the ~/.fastlane file. If you don't have the file, you can execute brew cask install fastlane command. If you already have it. Check other answers.
Get the full path of the fastlane executable from the command line:
which fastlane
Add it to the shell profile, restart shell.

rbenv and passenger - cannot install from not root user account(sudo group)

I'm just trying to setup my first rails server - on Ubuntu 12.04. I installed rbenv (as user: deployer with groups sudo and admin). Now trying to install passenger according to their docs.
I run passenger-install-nginx-module it starts but then I get
Please specify a prefix directory [/opt/nginx]:
--------------------------------------------
Permission problems
This installer must be able to write to the following directory:
/opt/nginx
But it can't do that, because you're running the installer as deployer.
Ok, I run sudo passenger-install-nginx-module then, and get sudo: passenger-install-nginx-module: command not found.
Does it mean I have to install it by loggin as root, installing whole rbenv for root user and then install passenger? Every tutorial I read they run it from not root user account :/, it doesn't work for me.
As I wrote in my comment, you have to run the passenger-install-nginx-module as root with the full path, because it is not in the $PATH var of your bash. To find out the path, run which passenger-install-nginx-module

Getting Redis up an running with ruby

I have installed Redis via gems, but am having a problem getting it started.
Following James Edward Gary II steps http://blog.grayproductions.net/articles/setting_up_the_redis_server/
I have:
$ sudo gem install ezmobius-redis
Password:
Successfully installed ezmobius-redis-0.1
1 gem installed
Installing ri documentation for ezmobius-redis-0.1...
Installing RDoc documentation for ezmobius-redis-0.1...
$ redis-server path/to/redis.conf
-bash: redis-server: command not found
Any thoughts as to what I am missing?
If you have done just what you have described in your question, then you are missing redis. ezmobius-redis is just a Ruby library that allows connecting to redis. redis itself is a separate piece of software running independently.
If you followed the article you linked and if you especially did this:
curl -O http://redis.googlecode.com/files/redis-1.0.tar.gz
tar xzvf redis-1.0.tar.gz
cd redis-1.0
make
sudo cp redis-server redis-cli redis-benchmark /usr/local/bin
then you have actually installed a very old version of redis into the /usr/local directory.
If you did this starting the server did not work, then you probably have /usr/local not in your PATH. You can start the server using:
$ /usr/local/bin/redis-server path/to/redis.conf
However, I would suggest to install the newest version of redis. To do that on OSX you should use homebrew:
- Read this (https://github.com/mxcl/homebrew/wiki/Installation) as a guide on how to install homebrew and then do a
brew install redis
to install the newest version of redis.
You might need to open a new terminal to get the latest path settings. Try typing "bash" or "xterm &" and typing the redis-server command again.

Resources