0

iTerm2 3.0.15
OS X 10.11.6

I tried recently to configure my terminal, after a clean install. My problem is that when I do it, I get a weird error message. I go in my .bash directory; In it, I have several configuration files, named as follows: aliases, bash_profile, exports, extras, functions, inputrc, path and prompt.

When I do:

source bash_profile

I get this error message:

-bash: book: command not found

I get exactly the same error message with every configuration file.

I have 2 problems:

  1. my bash_profile file isn't sourced, as any other configuration file I try

  2. I'm pretty sure it's fundamental to configure my terminal but I don't understand what the error message really means. I get that there is an issue with that book command but I can't get any valuable info about it.

Things I tried:

  • Terminal commands: man book, book --help, or help book told me the book command doesn't exist or doesn't have a manual entry. Only info book gave me a result but it looks like it's more related to the info command than the book command. And no mention of any book in my configuration files too.

  • Google search "bash: book: command not found" doesn't return much, of course lots of "command not found" but the only reference to book is a post on the Github repo of Bash-it. Most of the answers about command not found are about the PATH environment variable, but even if I input my path manually, like this (I hope this is the correct way):

    export PATH=~/.rbenv/shims:/usr/local/Cellar:/usr/local/bin:/usr/local/sbin:/usr/local/bin/flake8:/usr/local/bin/git:/usr/bin:/bin:/usr/sbin:/sbin
    

    After that, when I try again a source bash_profile, I get the same result -bash: book: command not found.

  • Terminal.app has the same issue.

my bash_profile file:

#--------------------------------------------------------------------------#

# B A S H _ P R O F I L E

#--------------------------------------------------------------------------#

# Load .bashrc if it exists
test -f ~/.bashrc && source ~/.bashrc

# Load the shell dotfiles, and then some:
# * ~/.path can be used to extend `$PATH`.
# * ~/.extra can be used for other settings you don’t want to commit.
for file in ~/.bash/{path,prompt,exports,aliases,functions,extra,inputrc}; do
    [ -r "$file" ] && [ -f "$file" ] && source "$file";
done;
unset file;

# Enable iTerm 2 Shell Integration
source ~/.iterm2_shell_integration.`basename $SHELL`

# Case-insensitive globbing (used in pathname expansion)
shopt -s nocaseglob;

# Append to the Bash history file, rather than overwriting it
shopt -s histappend;

# Autocorrect typos in path names when using `cd`
shopt -s cdspell;

# Do not autocomplete when accidentally pressing Tab on an empty line.
shopt -s no_empty_cmd_completion

# Enable tab completion for `g` by marking it as an alias for `git`
if type _git &> /dev/null && [ -f /usr/local/etc/bash_completion.d/git-completion.bash ]; then
    complete -o default -o nospace -F _git g;
fi;

# Add tab completion for many Bash commands
#if which brew > /dev/null && [ -f "$(brew --prefix)/share/bash-completion/#bash_completion" ]; then
#   source "$(brew --prefix)/share/bash-completion/bash_completion";
#elif [ -f /etc/bash_completion ]; then
#    source /etc/bash_completion;
#fi;

# Thanks to @tmoitie, adds more tab completion for bash,
# also when hitting tab twice it will show a list.
#if [ -f $(brew --prefix)/etc/bash_completion ]; then
#    . $(brew --prefix)/etc/bash_completion
#fi

# R U B Y
# Ensure rbenv will be used first
# eval "$(rbenv init -)"
# test -e "${HOME}/.iterm2_shell_integration.bash" && source "${HOME}/.iterm2_shell_integration.bash" 
3

1 Answer 1

0

I finally installed Bash 4.4.19 via Homebrew and edited iTerm preferences to use it. I renamed my configuration files by adding a dot before the name, and to my atonishment it worked, i.e. when I manually sourced my condiguration files iTerm reflected the changes.

I don't know if I would have obtained the same results by directly rename my files or if the change induced by the new version of Bash is the reason it finally worked. I don't know bash very well, but I suppose there is a default configuration that was somehow messed up, and using a fresh install of a new version with its own default configuration has done just enough to work.

After some use, I realized iTerm wouldn't automatically load the .bash_profile file at launch. Fortunatly, I found a solution: in the preferences of the app where you can specify where to find the executable, you can add a command to execute at launch. source ~/.bash_profile will do the work until I find a better fix.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.