Unable to install Heroku CLI under 2.0

heroku
2.0

#1

Attempting to run the recommended .circleci/setup-heroku.sh at the end of my 2.0 script fails with permissions issues:

bash .circleci/setup-heroku.sh
Your build output is too large to display in the browser. Only the first 400000 characters are displayed.
Download the full output as a file.
--2017-08-25 04:19:04--  https://cli-assets.heroku.com/branches/stable/heroku-linux-amd64.tar.gz
Resolving cli-assets.heroku.com (cli-assets.heroku.com)... 52.84.125.241, 52.84.125.34, 52.84.125.41, ...
Connecting to cli-assets.heroku.com (cli-assets.heroku.com)|52.84.125.241|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 21425775 (20M) [application/x-tar]
Saving to: ‘heroku-linux-amd64.tar.gz’


heroku-linux-amd64.   0%[                      ]       0  --.-KB/s             
eroku-linux-amd64.t  23%[====>                 ]   4.76M  23.5MB/s             
roku-linux-amd64.ta  47%[=========>            ]   9.63M  23.7MB/s             
oku-linux-amd64.tar  68%[==============>       ]  14.01M  23.1MB/s             
ku-linux-amd64.tar.  91%[===================>  ]  18.63M  23.1MB/s             
heroku-linux-amd64. 100%[=====================>]  20.43M  22.9MB/s   in 0.9s   

2017-08-25 04:19:05 (22.9 MB/s) - ‘heroku-linux-amd64.tar.gz’ saved [21425775/21425775]

heroku/
tar: heroku: Cannot mkdir: Permission denied
heroku/README
tar: heroku: Cannot mkdir: Permission denied
tar: heroku/README: Cannot open: No such file or directory
heroku/install
tar: heroku: Cannot mkdir: Permission denied
tar: heroku/install: Cannot open: No such file or directory
heroku/lib/
tar: heroku: Cannot mkdir: Permission denied
tar: heroku/lib: Cannot mkdir: No such file or directory

… and so on as the archive cannot be unpacked. What am I missing?


#2

I run into the same issue following the Heroku Deployment Integration Guide.

Instead of this snippet in the .circleci/setup-heroku.sh script:

wget https://cli-assets.heroku.com/branches/stable/heroku-linux-amd64.tar.gz
mkdir -p /usr/local/lib /usr/local/bin
tar -xvzf heroku-linux-amd64.tar.gz -C /usr/local/lib
ln -s /usr/local/lib/heroku/bin/heroku /usr/local/bin/heroku

I removed it and replace it with:

 wget -qO- https://cli-assets.heroku.com/install-ubuntu.sh | sh

found in the Heroku CLI documentation

Update: You can also use sudo. The Project Walkthrough guide has been updated to reflect this:

...
sudo mkdir -p /usr/local/lib /usr/local/bin
sudo tar -xvzf heroku-linux-amd64.tar.gz -C /usr/local/lib
sudo ln -s /usr/local/lib/heroku/bin/heroku /usr/local/bin/heroku

#3