curl -fsSL https://chatgpt.com/codex/install.sh | sh
This downloads an installation script and immediately runs it.
curl retrieves data from a URL:
curl https://chatgpt.com/codex/install.sh
Without the other pieces, this would print the script’s contents in your terminal.
-fsSL
These are four combined options:
-f— fail on HTTP errors such as 404 or 500.-s— silent mode; hides the progress meter.-S— still show an error message when-sis active.-L— follow redirects if the URL points elsewhere.
The same options could be written as:
curl --fail --silent --show-error --location
The URL
https://chatgpt.com/codex/install.sh
This is the shell script being downloaded.
|
The pipe sends the output of the command on its left into the command on its right:
downloaded script → sh
sh
sh executes the downloaded text as a shell script.
So the complete command effectively means:
Download the Codex installer quietly, follow redirects, report errors, and immediately execute the result.
A safer approach is to download and inspect it first:
curl -fsSL https://chatgpt.com/codex/install.sh -o codex-install.sh
less codex-install.sh
sh codex-install.sh
This avoids blindly executing whatever the server returns. Also, the backslash shown before -fsSL in some formatted text is just escaping; type -fsSL, not \-fsSL.