The easiest way to install Cloud Foundry in a macOS system is to use the homebrew package manager.
To install homebrew, we just need to execute the next line in our Terminal:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Once installed, you can “tap” the Cloud Foundry repository:
brew tap cloudfoundry/tap
Finally, you install the Cloud Foundry CLI with:
brew install cloudfoundry/tap/cf-cli
Once you have installed the CLI tool, you should be able to verify that it works, by opening a Terminal and running:
This should show something like:
cf version 6.30.0+decf883fc.2017-09-01
If you see a result like this, the CLI is installed correctly and you can start playing.
Now, we need a trial account in a Cloud Foundry provider. There are multiple option we can check in the Cloud Foundry Certified Providers page. Once we have created the account we can proceed to login with out CLI.
cf login API endpoint> https://api.eu-gb.bluemix.net Email>email@example.com Password> Authenticating... OK Targeted org example Targeted space dev API endpoint: https://api.eu-gb.bluemix.net (API version: 2.75.0) User: firstname.lastname@example.org Org: example Space: dev
In the above output, the email is the address you used to sign up for a service.
Once you have successfully logged in, you are authenticated with the system and the Cloud Foundry provider you use knows what information you can access and what your account can do.
The CLI tool stores some of this information, the Cloud Foundry Endpoint API, and a “token” given when you authenticated. When you logged in, instead of saving your password, Cloud Foundry generated a temporary token that the CLI can store. The CLI then can use this token instead of asking for your email and password again for every command.
The token will expire, usually in 24 hours, and the CLI will need you to login again. When you do, it will remember the last API Endpoint you used, so you now only have to provide your email and password to re-authenticate for another 24 hours.
- cf help: Shows CLI help.
- cf help <command>: Shows CLI help for an specific command.
- cf <command> –help: Shows CLI help for an specific command.
- cf help -a: Lists all the commands available in the CLI.