Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fast Heroku command-line interface
Go Shell HTML

Merge pull request #192 from ejholmes/api-url-plugin

Properly set apiURL to the value in the HEROKU_API_URL environment variable.
latest commit b8aeaa3ab3
Brandur brandur authored
Failed to load latest commit information.
Godeps Rewrite import paths
contrib zsh auto-complete app name in addon-open
doc Add info about how to stop a 'hk run' dyno
hkclient Rewrite import paths
hkdist Rewrite import paths
postgresql Rewrite import paths
rollbar report panics to Rollbar unless version is dev
term make IsTerminal() work on Windows
.gitignore Add .env to gitignore
.travis.yml Setup Travis-CI to test on Go 1.3. add a few code standard notes
LICENSE Add a proper MIT LICENSE file.
Procfile Procfile add setting for strict-flag-ordering
about.go Add a proper MIT LICENSE file.
access.go Rewrite import paths
account_features.go Rewrite import paths
addons.go Rewrite import paths
addons_test.go addon-add command
api.go Rename printUsage() -> PrintUsage()
apps.go Rewrite import paths
auth.go Rewrite import paths
create.go Rewrite import paths
data.go Rewrite import paths
destroy.go Rename printUsage() -> PrintUsage()
dev.go use go-update, and other update cleanup
domains.go Rewrite import paths
drains.go Rewrite import paths
dynos.go Rewrite import paths
env.go Rename printUsage() -> PrintUsage()
fakenetrc add tests for dev environment usage
features.go Rewrite import paths
git.go Rewrite import paths
git_test.go Support HTTP git.
help.go document ability to use git remote in -a flag
info.go Rename printUsage() -> PrintUsage()
keys.go Rename printUsage() -> PrintUsage()
log.go Rewrite import paths
main.go Properly set apiURL to the value in the HEROKU_API_URL environment va…
main_test.go Properly set apiURL to the value in the HEROKU_API_URL environment va…
maintenance.go Rewrite import paths
members.go Rewrite import paths
open.go Rename printUsage() -> PrintUsage()
orgs.go Rewrite import paths
pg.go Rewrite import paths
pg_helper.go Rewrite import paths
pg_helper_test.go resolve heroku-postgresql options to URLs
plugin.go Authenticate like the Heroku CLI
regions.go Rename printUsage() -> PrintUsage()
releases.go Rewrite import paths
rename.go Rewrite import paths
restart.go Add info about how to stop a 'hk run' dyno
run.go Rewrite import paths
scale.go Rewrite import paths
scale_test.go tests to ensure PX dyno scale works
ssl.go Rewrite import paths
ssl_helper.go display of SSL endpoint info, ability to add certs
status.go Rename printUsage() -> PrintUsage()
suggest.go suggest help topics as help commands
time_test.go ls dynos
transfer.go Rewrite import paths
unix.go consolidate homePath() logic in hkclient as HomePath()
update.go Rewrite import paths
url.go Rename printUsage() -> PrintUsage()
util.go Rewrite import paths
util_test.go Fix login issues with no netrc file
which_app.go rename which-app.go -> which_app.go
windows.go use os/user to determine home directory on Windows


A fast Heroku CLI client.


hk is a command line client to the Heroku runtime platform, designed to be as fast as possible.


This is beta software. It may still undergo substantial changes during the coming months. You should expect that some functionality may break or be altered without warning.


Fast as a feature

## version

$ time heroku version >/dev/null
real    0m1.813s

$ time hk version >/dev/null
real    0m0.016s

## list

$ time heroku apps >/dev/null
real    0m3.830s

$ time hk apps >/dev/null
real    0m0.785s

Iterative Development

A release mechanism was created for hk in the beginning: the binary updates itself. This gives us confidence in iterative development, which we value highly, because it gives us the ability to release very often knowing users will see the updates in a timely manner.

The power of Go

hk demonstrates the power of the Go language, runtime, systems access, and distribution story (a single, statically linked binary with no dependencies) which are all very appealing to Heroku.


Heroku loves Unix. This client should reflect that. Commands map to their unix ancestors’ names and flags where applicable.


Please note that versions of hk installed from source are unsupported and should only be installed for development purposes.

Mac OS X, Linux, BSD

Pre-built binaries are available for Mac OS X, Linux, and BSD. Once installed, these binaries will automatically update themselves when new releases are available.

To install a pre-built binary release, run the following one-liner:

$ L=/usr/local/bin/hk && curl -sL -A "`uname -sp`" | zcat >$L && chmod +x $L

The URL will attempt to detect your OS and CPU architecture based on the User-Agent, then redirect you to the latest release for your platform.


Currently, you need to have a Go development environment to install hk on Windows. Compiled binaries with automatic updating are available for Windows, but the installer is not ready yet.

$ go get

Please note that this installation method is unsupported.


The basic usage of hk is:

Usage: hk <command> [-a app] [options] [arguments]

For more details, and to learn about differences between hk and the Heroku Ruby CLI, please see the getting started guide.

Shell Completion

Shell completion scripts for hk have been written for zsh and bash. Both files are located in ./contrib.

The zsh completion script completes all command names and help topics. It also completes flags and other arguments for many commands:

The bash completion script completes only command names at this time.


hk allows some configuration using git config.

Use strict flag ordering / disable interspersed flags and non-flag arguments


$ git config --global --bool hk.strict-flag-ordering true


$ git config --global --unset hk.strict-flag-ordering


hk currently has a minimal plugin system. It may see substantial changes in the future, and those changes may break existing plugins or change the architecture at any time. Use this functionality at your own risk.

Plugins are executables located in HKPATH or, if HKPATH does not exist, in /usr/local/lib/hk/plugin. They are executed when hk does not know command X and an installed plugin X exists. The special case default plugin will be executed if hk has no command or installed plugin named X.

hk will set these environment variables for a plugin:

  • HEROKU_API_URL - The url containing the username, password, and host to the api endpoint.
  • HKAPP - The app as determined by the git heroku remote, if available.
  • HKUSER - The username from either HEROKU_API_URL or .netrc
  • HKPASS - The password from either HEROKU_API_URL or .netrc
  • HKHOST - The hostname for the API endpoint


hk requires Go 1.2 or later and uses Godep to manage dependencies.

$ cd hk
$ vim main.go
$ godep go build
$ ./hk apps

Please follow the contribution guidelines before submitting a pull request.

Something went wrong with that request. Please try again.