Update Ruby installation instructions to use rbenv instead of chruby

This commit is contained in:
Kerby Martino committed 2025-04-29 04:07:14 +08:00
1 parent 61e1e3f4b8
commit 48a52a78d9
1 file changed
+78 -4
+78 -4
View File
@@ -13,23 +13,97 @@ Head to this website to know more about jekyll https://jekyllrb.com/docs/
### Installing
First, install Homebrew if you don't already have it:
```bash
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
```
Install rbenv and ruby-build:
```bash
brew install rbenv ruby-build
```
Add rbenv to your shell:
```bash
echo 'eval "$(rbenv init - zsh)"' >> ~/.zshrc
# Or for bash
# echo 'eval "$(rbenv init - bash)"' >> ~/.bashrc
```
Restart your terminal or source your profile:
```bash
source ~/.zshrc # or ~/.bashrc
```
Install the latest stable Ruby version:
```bash
rbenv install 3.2.2 # or any newer version
```
Set it as your global Ruby version:
```bash
rbenv global 3.2.2
```
Verify the installation:
```bash
ruby -v
```
Install bundler:
```bash
gem install bundler
```
Navigate back to your project and try running bundler again:
```bash
bundle install
bundle exec jekyll serve --livereload
```
### Executing program
After installation, you can run the Jekyll site locally:
* How to run the program
* with live reload
* With live reload (automatically refreshes the browser when files change):
```
bundle exec jekyll serve --livereload
```
* without live reload
* Without live reload:
```
bundle exec jekyll serve
```
Once the server is running, you can view the site by opening a browser and navigating to:
```
http://localhost:4000
```
### Troubleshooting
If you encounter any issues during installation or execution:
1. Make sure Ruby is installed and up to date:
```
ruby -v
```
2. If you encounter permission errors with Homebrew:
```
sudo chown -R $(whoami) /usr/local/Homebrew
```
3. If bundle install fails with dependency issues:
```
bundle update
bundle install
```
4. If you see "command not found: jekyll", ensure Jekyll is properly installed:
```bash
gem install jekyll
gem install bundler
```
For more information, refer to the [Jekyll documentation](https://jekyllrb.com/docs/).