Last active
June 14, 2025 13:19
-
-
Save theinventor/9eeb6623dee6370ccbac97a7cd5cc89a to your computer and use it in GitHub Desktop.
openai codex rails setup
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apt-get update | |
apt-get install -y postgresql postgresql-contrib libpq-dev | |
service postgresql start | |
sudo -u postgres createuser --createdb --login jumpstart | |
sudo -u postgres psql -c "ALTER USER jumpstart WITH PASSWORD 'mypassword';" | |
# Install Ruby 3.4.2 using ruby-build | |
if ! command -v rbenv >/dev/null; then | |
git clone https://github.com/rbenv/rbenv.git ~/.rbenv | |
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc | |
echo 'eval "$(rbenv init -)"' >> ~/.bashrc | |
export PATH="$HOME/.rbenv/bin:$PATH" | |
eval "$(rbenv init -)" | |
fi | |
if ! command -v ruby-build >/dev/null; then | |
git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build | |
export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH" | |
fi | |
# Install Ruby 3.4.2 | |
rbenv install -s 3.4.2 | |
rbenv global 3.4.2 | |
# Ensure rbenv shims are up to date | |
rbenv rehash | |
gem install bundler | |
apt-get install -y libyaml-dev | |
bundle install | |
./bin/rails db:prepare |
Thanks for this! Minor changes got it working for me:
# Install PostgreSQL and lib dependencies
apt-get update
apt-get install -y postgresql postgresql-contrib libpq-dev libyaml-dev
# Start PostgreSQL
service postgresql start
sudo -u postgres createuser --createdb --login root
# Install rbenv and ruby-build if not present
if ! command -v rbenv >/dev/null; then
git clone https://github.com/rbenv/rbenv.git ~/.rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(rbenv init -)"' >> ~/.bashrc
export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"
fi
if [ ! -d "$HOME/.rbenv/plugins/ruby-build" ]; then
git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build
export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"
fi
# Install Ruby
rbenv install -s 3.4.1
rbenv global 3.4.1
rbenv rehash
# Install bundler and dependencies
gem install bundler
bundle install
# Prepare the database
./bin/rails db:prepare
Codex suggested to change line
sudo -u postgres createuser --createdb --login root
to
sudo -u postgres createuser --superuser --createdb --login root
Otherwise loading fixtures caused PG::InsufficientPrivilege
error.
Thanks for sharing, has anyone gotten chrome setup so that bin/rails test:system
works?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Also, THIS one installs ruby 3.4.2 successfully with rbenv