0

I recently downloaded Ruby onto my mac via rbenv, and I read instructions that showed me how to start up rbenv every time I open terminal. Is there a way to view all the startup scripts for terminal?

Here's the script I used:

echo 'if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi' >> ~/.bash_profile
source ~/.bash_profile
1

3 Answers 3

1

Most startup settings for terminal/console (including scripts) are kept in or loaded from ~/.bashrc and ~/.bash_profile, which are hidden files in your user home directory.

You can edit them manually with a text editor to suit your preferences (make a backup of them first, just in case).

0
1

What profiles (Shell init scripts) are parsed on process spawn depends on your shell. This is the documentation man page for bash. There are two different sets of scrips sourceed depending on if the shell is spawned with --login or without.

bash --login

it first reads and executes commands from the file /etc/profile, if that file exists. After reading that file, it looks for ~/.bash_profile, ~/.bash_login, and ~/.profile, in that order

bash

When an interactive shell that is not a login shell is started, bash reads and executes commands from /etc/bash.bashrc and ~/.bashrc

note

The only impact the very weird --login flag has, is the init script file location. If you configure your system, just do ~/.profile and make ~/.bashrc symlink to it.

0

Run bash in verbose mode

If you want to know what's being run when you start up bash, you can start a new session of bash with the verbose option:

bash -v

It should print out every command that runs automatically, from files like ~/.bash_profile and ~/.bashrc.

Use the xtrace mode for even more detail

That looks like this:

bash -x

From the man page:

              -x      After expanding each simple command, for command,  case  com‐
                      mand,  select command, or arithmetic for command, display the
                      expanded value of PS4, followed by the command  and  its  ex‐
                      panded arguments or associated word list.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.