Update code block in readme for rbenv-doctor script (#1353)

Co-authored-by: Mislav Marohnić <git@mislav.net>
This commit is contained in:
Audree Steinberg 2021-10-21 06:23:46 -07:00 committed by GitHub
parent 38e1fbb08e
commit 6cc7bff383
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

119
README.md
View file

@ -127,9 +127,9 @@ Version names to rbenv are simply the names of the directories in
If you're on macOS, we recommend installing rbenv with If you're on macOS, we recommend installing rbenv with
[Homebrew](https://brew.sh). [Homebrew](https://brew.sh).
~~~ sh ```sh
$ brew install rbenv brew install rbenv
~~~ ```
Note that this also installs `ruby-build`, so you'll be ready to Note that this also installs `ruby-build`, so you'll be ready to
install other Ruby versions out of the box. install other Ruby versions out of the box.
@ -139,13 +139,14 @@ If you're on macOS, we recommend installing rbenv with
To upgrade to the latest rbenv and update ruby-build with newly released To upgrade to the latest rbenv and update ruby-build with newly released
Ruby versions, upgrade the Homebrew packages: Ruby versions, upgrade the Homebrew packages:
~~~ sh ```sh
$ brew upgrade rbenv ruby-build brew upgrade rbenv ruby-build
~~~ ```
- **Debian, Ubuntu and their derivatives** - **Debian, Ubuntu and their derivatives**
~~~ sh
$ sudo apt install rbenv ```sh
~~~ sudo apt install rbenv
```
- **Arch Linux and it's derivatives** - **Arch Linux and it's derivatives**
Archlinux has an [AUR Package](https://aur.archlinux.org/packages/rbenv/) for Archlinux has an [AUR Package](https://aur.archlinux.org/packages/rbenv/) for
@ -154,9 +155,9 @@ If you're on macOS, we recommend installing rbenv with
2. Set up rbenv in your shell. 2. Set up rbenv in your shell.
~~~ sh ```sh
$ rbenv init rbenv init
~~~ ```
Follow the printed instructions to [set up rbenv shell integration](#how-rbenv-hooks-into-your-shell). Follow the printed instructions to [set up rbenv shell integration](#how-rbenv-hooks-into-your-shell).
@ -166,8 +167,11 @@ If you're on macOS, we recommend installing rbenv with
4. Verify that rbenv is properly set up using this 4. Verify that rbenv is properly set up using this
[rbenv-doctor](https://github.com/rbenv/rbenv-installer/blob/main/bin/rbenv-doctor) script: [rbenv-doctor](https://github.com/rbenv/rbenv-installer/blob/main/bin/rbenv-doctor) script:
~~~ sh ```sh
$ curl -fsSL https://github.com/rbenv/rbenv-installer/raw/main/bin/rbenv-doctor | bash curl -fsSL https://github.com/rbenv/rbenv-installer/raw/main/bin/rbenv-doctor | bash
```
```sh
Checking for `rbenv' in PATH: /usr/local/bin/rbenv Checking for `rbenv' in PATH: /usr/local/bin/rbenv
Checking for rbenv shims in PATH: OK Checking for rbenv shims in PATH: OK
Checking `rbenv install' support: /usr/local/bin/rbenv-install (ruby-build 20170523) Checking `rbenv install' support: /usr/local/bin/rbenv-install (ruby-build 20170523)
@ -176,7 +180,7 @@ If you're on macOS, we recommend installing rbenv with
You can install Ruby versions like so: rbenv install 2.2.4 You can install Ruby versions like so: rbenv install 2.2.4
Checking RubyGems settings: OK Checking RubyGems settings: OK
Auditing installed plugins: OK Auditing installed plugins: OK
~~~ ```
5. That's it! Installing rbenv includes ruby-build, so now you're ready to 5. That's it! Installing rbenv includes ruby-build, so now you're ready to
[install some other Ruby versions](#installing-ruby-versions) using [install some other Ruby versions](#installing-ruby-versions) using
@ -194,16 +198,16 @@ a systemwide install.
1. Clone rbenv into `~/.rbenv`. 1. Clone rbenv into `~/.rbenv`.
~~~ sh ```sh
$ git clone https://github.com/rbenv/rbenv.git ~/.rbenv git clone https://github.com/rbenv/rbenv.git ~/.rbenv
~~~ ```
Optionally, try to compile dynamic bash extension to speed up rbenv. Don't Optionally, try to compile dynamic bash extension to speed up rbenv. Don't
worry if it fails; rbenv will still work normally: worry if it fails; rbenv will still work normally:
~~~ ```sh
$ cd ~/.rbenv && src/configure && make -C src cd ~/.rbenv && src/configure && make -C src
~~~ ```
2. Add `~/.rbenv/bin` to your `$PATH` for access to the `rbenv` 2. Add `~/.rbenv/bin` to your `$PATH` for access to the `rbenv`
command-line utility. command-line utility.
@ -211,30 +215,30 @@ a systemwide install.
* For **bash**: * For **bash**:
Ubuntu Desktop users should configure `~/.bashrc`: Ubuntu Desktop users should configure `~/.bashrc`:
~~~ bash ```bash
$ echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
~~~ ```
On other platforms, bash is usually configured via `~/.bash_profile`: On other platforms, bash is usually configured via `~/.bash_profile`:
~~~ bash ```bash
$ echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profile echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profile
~~~ ```
* For **Zsh**: * For **Zsh**:
~~~ zsh ```zsh
$ echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.zshrc echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.zshrc
~~~ ```
* For **Fish shell**: * For **Fish shell**:
~~~ fish ```fish
$ set -Ux fish_user_paths $HOME/.rbenv/bin $fish_user_paths set -Ux fish_user_paths $HOME/.rbenv/bin $fish_user_paths
~~~ ```
3. Set up rbenv in your shell. 3. Set up rbenv in your shell.
~~~ sh ```sh
$ ~/.rbenv/bin/rbenv init ~/.rbenv/bin/rbenv init
~~~ ```
Follow the printed instructions to [set up rbenv shell integration](#how-rbenv-hooks-into-your-shell). Follow the printed instructions to [set up rbenv shell integration](#how-rbenv-hooks-into-your-shell).
@ -244,8 +248,11 @@ a systemwide install.
5. Verify that rbenv is properly set up using this 5. Verify that rbenv is properly set up using this
[rbenv-doctor](https://github.com/rbenv/rbenv-installer/blob/main/bin/rbenv-doctor) script: [rbenv-doctor](https://github.com/rbenv/rbenv-installer/blob/main/bin/rbenv-doctor) script:
~~~ sh ```sh
$ curl -fsSL https://github.com/rbenv/rbenv-installer/raw/main/bin/rbenv-doctor | bash curl -fsSL https://github.com/rbenv/rbenv-installer/raw/main/bin/rbenv-doctor | bash
```
```sh
Checking for `rbenv' in PATH: /usr/local/bin/rbenv Checking for `rbenv' in PATH: /usr/local/bin/rbenv
Checking for rbenv shims in PATH: OK Checking for rbenv shims in PATH: OK
Checking `rbenv install' support: /usr/local/bin/rbenv-install (ruby-build 20170523) Checking `rbenv install' support: /usr/local/bin/rbenv-install (ruby-build 20170523)
@ -254,7 +261,7 @@ a systemwide install.
You can install Ruby versions like so: rbenv install 2.2.4 You can install Ruby versions like so: rbenv install 2.2.4
Checking RubyGems settings: OK Checking RubyGems settings: OK
Auditing installed plugins: OK Auditing installed plugins: OK
~~~ ```
6. _(Optional)_ Install [ruby-build][], which provides the 6. _(Optional)_ Install [ruby-build][], which provides the
`rbenv install` command that simplifies the process of `rbenv install` command that simplifies the process of
@ -265,18 +272,18 @@ a systemwide install.
If you've installed rbenv manually using Git, you can upgrade to the If you've installed rbenv manually using Git, you can upgrade to the
latest version by pulling from GitHub: latest version by pulling from GitHub:
~~~ sh ```sh
$ cd ~/.rbenv cd ~/.rbenv
$ git pull git pull
~~~ ```
#### Updating the list of available Ruby versions #### Updating the list of available Ruby versions
If you're using the `rbenv install` command, then the list of available Ruby versions is not automatically updated when pulling from the rbenv repo. To do this manually: If you're using the `rbenv install` command, then the list of available Ruby versions is not automatically updated when pulling from the rbenv repo. To do this manually:
```sh ```sh
$ cd ~/.rbenv/plugins/ruby-build cd ~/.rbenv/plugins/ruby-build
$ git pull git pull
``` ```
### How rbenv hooks into your shell ### How rbenv hooks into your shell
@ -318,7 +325,7 @@ is provided by the [ruby-build][] project. If you installed it either
as part of GitHub checkout process outlined above or via Homebrew, you as part of GitHub checkout process outlined above or via Homebrew, you
should be able to: should be able to:
~~~ sh ```sh
# list latest stable versions: # list latest stable versions:
$ rbenv install -l $ rbenv install -l
@ -327,7 +334,7 @@ $ rbenv install -L
# install a Ruby version: # install a Ruby version:
$ rbenv install 2.0.0-p247 $ rbenv install 2.0.0-p247
~~~ ```
Set a Ruby version to finish installation and start using commands `rbenv global 2.0.0-p247` or `rbenv local 2.0.0-p247` Set a Ruby version to finish installation and start using commands `rbenv global 2.0.0-p247` or `rbenv local 2.0.0-p247`
@ -383,7 +390,7 @@ uninstall from the system.
remove rbenv shims directory from PATH, and future invocations like remove rbenv shims directory from PATH, and future invocations like
`ruby` will execute the system Ruby version, as before rbenv. `ruby` will execute the system Ruby version, as before rbenv.
`rbenv` will still be accessible on the command line, but your Ruby While disabled, `rbenv` will still be accessible on the command line, but your Ruby
apps won't be affected by version switching. apps won't be affected by version switching.
2. To completely **uninstall** rbenv, perform step (1) and then remove 2. To completely **uninstall** rbenv, perform step (1) and then remove
@ -393,17 +400,11 @@ uninstall from the system.
rm -rf `rbenv root` rm -rf `rbenv root`
If you've installed rbenv using a package manager, as a final step If you've installed rbenv using a package manager, as a final step
perform the rbenv package removal. perform the rbenv package removal:
- Homebrew: - Homebrew: `brew uninstall rbenv`
- Debian, Ubuntu, and their derivatives: `sudo apt purge rbenv`
`brew uninstall rbenv` - Archlinux and its derivatives: `sudo pacman -R rbenv`
- Debian, Ubuntu and their derivatives:
`sudo apt purge rbenv`
- Archlinux and it's derivatives:
`sudo pacman -R rbenv`
## Command Reference ## Command Reference