rbenv使用
Tag: Ruby
Tag: Rails
Category: jekyll
Category: update
Category: git
Category: database
Category: PostgreSQL
Category: websocket
Category: ruby
Category: projects
Category: Redis
Category: mysql
Category: Mac
Category: Node
Category: NPM
Category: PM2
Category: nodejs
Category: Meteor
Category: Nginx
Category: gitLab
Category: Rails
- Why Ruby on Rails is better than Python Django?
- How to use Hotwire turbo in Rails 6 with Webpacker?
- Rails 6 Credentials (master.key and credentials.yml.enc)
- Rails Console
- JIRA-Atlassian-Connect-App-Django
- Rails 4 5.0 Session Cookie AuthenticityToken
- Rails Active Storage
- Rails 5 Source code Research
- 微信支付
- Rails零星笔记
Category: Homebrew
Category: CentOS
Category: FreeSwitch
Category: Ruby
- Ruby on Rails 8
- RESTful API
- Ruby on Rails 7
- Study from Ruby official website
- Ruby-Metaprogramming
- Ruby连数据库的问题
- rbenv使用
Category: Vim
Category: javascript
Category: React-Native
Category: Wechat
Category: homeland
Category: JavaScript
Category: Docker
Category: RubyMine
Category: Authorization
Category: RESTful-API
Category: Proxy
Category: Deploy
Category: Devise
Category: Bootstrap
Category: Active_Storage
Category: github
Category: Android
Category: cloud
Category: ssh
Category: python
Category: reactjs
Category: markdown
Category: ShadowSocks
Category: Code
Category: rails
Category: code
Category: Django
Category: Python
Category: DRF
Category: Fish
Category: Yarn
Category: Material-UI
Category: CSS
Category: aws
Category: uwsgi
Category: nginx
Category: docker
Category: React
Category: Enzyme
Category: Jira
Category: Interview
Category: JetBrain
Category: PyCharm
Category: ESLint
Category: Rails6
Category: NVM
Category: ssl
Category: tencent
Category: CI
Category: jenkins
Category: GitHub
Category: Credentials
Category: master.key
Category: Webpacker
Category: Turbo
Category: Hotwire
Category: Bootstrap5
Category: Flutter
Category: Clash
Category: Tor
Category: proxy
Category: Build
Category: SwitchyOmega
Category: Chrome-extension
Category: SQLAlchemy
Category: Algorithm
Category: Rails7
Category: Data
Category: Structure
Category: CPP
Category: Languages
Category: Golang
Category: Typescript
Category: Rails 8
Mac下安装
在参考官方文档 https://github.com/rbenv/rbenv 的时候要注意:
$ echo 'eval "$(rbenv init -)"' >> ~/.bash_profile
这一行要执行下,否则$ rbenv shell
会报错.
rbenv-gemset
https://github.com/jf/rbenv-gemset
- 默认的gems可能是安装在
~/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems
.
如果系统已经存在某个gem,可能就不会安装到指定的目录了.这时可以gem uninstall --all
全部删除(看下~/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems
下是不是基本上空了?)
然后再bundle install
,这时看看gems是不是都安装到~/.rbenv/versions/2.2.3/gemsets/your_gemset_name
下了?
-
如果相要指定gemset下删除某个gem,可以用
$ RBENV_GEMSETS="-global" gem uninstall puma
-
$ rbenv gemset active
可以用于查看当前目录下有哪些gemset被使用到。
RubyMine8
RubyMine8.0开始支持rbenv-gemset了,不过目前RubyMine有个bug,就是在你通过Preferences => Ruby SDK and gems
改动时,会把所有的在同一个windows中的用到rbenv-gemset的项目的配置都改成一样的.rbenv-gemsets的定义,避免这个问题的办法是不同的Ruby项目在不同的window中打开.
常用命令
rbenv
$ rbenv local # 查看当前目录的ruby版本,和`less .ruby-version`一样的效果
$ rbenv global # 如果没有配local,默认用global,用本命令查看global ruby版本
$ rbenv versions # 显示当前系统中已经安装的ruby版本
$ rbenv version # 显示当前被激活的ruby版本
$ rbenv shell 3.0.2 # switch to a specific version
$ rbenv install -L # List all known ruby versions
$ rbenv uninstall 2.1.4 # Uninstall Ruby 2.1.4
$ rbenv rehash # 任何涉及到可执行命令的,都要rehash下,如安装了gem sequel等
$ rbenv which rake # 显示一个可执行shims下的bin所在的目录/Users/lane/.rbenv/versions/2.2.3/bin/rake
$ rbenv whence irb # 查看哪个版本有irb命令可用
rbenv-gemset
- This is not necessary.
rbenv
withbundler
works well enough.
$ rbenv-gemset delete 2.2.3 -global # 把2.2.3版本下的"-global"gemset删除,最终会把 /Users/you/.rbenv/versions/2.2.3/gemsets 下的"-global"目录删除
$ RBENV_GEMSETS="your_gemset" gem install thin # 在指定的gemset下安装一个gem
Relative articles
https://github.com/rbenv/rbenv/wiki/Understanding-binstubs