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
[Homebrew](https://brew.sh).
~~~ sh
$ brew install rbenv
~~~
```sh
brew install rbenv
```
Note that this also installs `ruby-build`, so you'll be ready to
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
Ruby versions, upgrade the Homebrew packages:
~~~ sh
$ brew upgrade rbenv ruby-build
~~~
```sh
brew upgrade rbenv ruby-build
```
- **Debian, Ubuntu and their derivatives**
~~~ sh
$ sudo apt install rbenv
~~~
```sh
sudo apt install rbenv
```
- **Arch Linux and it's derivatives**
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.
~~~ sh
$ rbenv init
~~~
```sh
rbenv init
```
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
[rbenv-doctor](https://github.com/rbenv/rbenv-installer/blob/main/bin/rbenv-doctor) script:
~~~ sh
$ curl -fsSL https://github.com/rbenv/rbenv-installer/raw/main/bin/rbenv-doctor | bash
```sh
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 shims in PATH: OK
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
Checking RubyGems settings: OK
Auditing installed plugins: OK
~~~
```
5. That's it! Installing rbenv includes ruby-build, so now you're ready to
[install some other Ruby versions](#installing-ruby-versions) using
@ -194,16 +198,16 @@ a systemwide install.
1. Clone rbenv into `~/.rbenv`.
~~~ sh
$ git clone https://github.com/rbenv/rbenv.git ~/.rbenv
~~~
```sh
git clone https://github.com/rbenv/rbenv.git ~/.rbenv
```
Optionally, try to compile dynamic bash extension to speed up rbenv. Don't
worry if it fails; rbenv will still work normally:
~~~
$ cd ~/.rbenv && src/configure && make -C src
~~~
```sh
cd ~/.rbenv && src/configure && make -C src
```
2. Add `~/.rbenv/bin` to your `$PATH` for access to the `rbenv`
command-line utility.
@ -211,30 +215,30 @@ a systemwide install.
* For **bash**:
Ubuntu Desktop users should configure `~/.bashrc`:
~~~ bash
$ echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
~~~
```bash
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
```
On other platforms, bash is usually configured via `~/.bash_profile`:
~~~ bash
$ echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profile
~~~
```bash
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profile
```
* For **Zsh**:
~~~ zsh
$ echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.zshrc
~~~
```zsh
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.zshrc
```
* For **Fish shell**:
~~~ fish
$ set -Ux fish_user_paths $HOME/.rbenv/bin $fish_user_paths
~~~
```fish
set -Ux fish_user_paths $HOME/.rbenv/bin $fish_user_paths
```
3. Set up rbenv in your shell.
~~~ sh
$ ~/.rbenv/bin/rbenv init
~~~
```sh
~/.rbenv/bin/rbenv init
```
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
[rbenv-doctor](https://github.com/rbenv/rbenv-installer/blob/main/bin/rbenv-doctor) script:
~~~ sh
$ curl -fsSL https://github.com/rbenv/rbenv-installer/raw/main/bin/rbenv-doctor | bash
```sh
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 shims in PATH: OK
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
Checking RubyGems settings: OK
Auditing installed plugins: OK
~~~
```
6. _(Optional)_ Install [ruby-build][], which provides the
`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
latest version by pulling from GitHub:
~~~ sh
$ cd ~/.rbenv
$ git pull
~~~
```sh
cd ~/.rbenv
git pull
```
#### 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:
```sh
$ cd ~/.rbenv/plugins/ruby-build
$ git pull
cd ~/.rbenv/plugins/ruby-build
git pull
```
### 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
should be able to:
~~~ sh
```sh
# list latest stable versions:
$ rbenv install -l
@ -327,7 +334,7 @@ $ rbenv install -L
# install a Ruby version:
$ 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`
@ -383,7 +390,7 @@ uninstall from the system.
remove rbenv shims directory from PATH, and future invocations like
`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.
2. To completely **uninstall** rbenv, perform step (1) and then remove
@ -393,17 +400,11 @@ uninstall from the system.
rm -rf `rbenv root`
If you've installed rbenv using a package manager, as a final step
perform the rbenv package removal.
- Homebrew:
`brew uninstall rbenv`
- Debian, Ubuntu and their derivatives:
`sudo apt purge rbenv`
- Archlinux and it's derivatives:
`sudo pacman -R rbenv`
perform the rbenv package removal:
- Homebrew: `brew uninstall rbenv`
- Debian, Ubuntu, and their derivatives: `sudo apt purge rbenv`
- Archlinux and its derivatives: `sudo pacman -R rbenv`
## Command Reference