【笔记】Ruby创建Rails项目

前言

Ruby创建Rails项目

下载依赖

1
2
brew install ruby
gem install rails

添加环境变量

1
2
echo "export PATH=$PATH:/opt/homebrew/Cellar/ruby/3.3.5/bin" >> ~/.zshrc
echo "export PATH=$PATH:/opt/homebrew/lib/ruby/gems/3.3.0/bin" >> ~/.zshrc

创建项目

1
2
rails new <project_name>
cd <project_name>

运行HTTP服务

1
rails server
1
2
3
4
5
6
7
8
9
10
11
12
=> Booting Puma
=> Rails 7.2.1 application starting in development
=> Run `bin/rails server --help` for more startup options
Puma starting in single mode...
* Puma version: 6.4.2 (ruby 3.3.5-p100) ("The Eagle of Durango")
* Min threads: 3
* Max threads: 3
* Environment: development
* PID: 25372
* Listening on http://127.0.0.1:3000
* Listening on http://[::1]:3000
Use Ctrl-C to stop

完成

参考文献

哔哩哔哩——鱼C-小甲鱼