Mac Terminal process ends and outputs [Process completed] when launched - macos

When I launch the Terminal app on Mac, the process will end and output the following:
Last login: Wed Aug 6 15:53:58 on ttys003
[Process completed]
This started happening when terminal froze and I restarted it. From then on, this is the message that is displayed.
I can change the Shell to bin/sh in Terminal's preferences, but this prevents me from using my .bash_profile script.
Does anyone have any ideas or suggestions on how to fix this?
Thanks!
PS Here's my .bash_profile. I tried commenting it out and running Terminal and it still didn't work, but here is per request.
export PATH="/usr/local/mysql/bin:$PATH"
##
# Your previous /Users/mjmitchener/.bash_profile file was backed up as /Users/mjmitchener/.bash_profile.macports-saved_2013-05-06_at_09:58:31
##
# MacPorts Installer addition on 2013-05-06_at_09:58:31: adding an appropriate PATH variable for use with MacPorts.
export PATH="/opt/local/bin:/opt/local/sbin:$PATH"
# Finished adapting your PATH environment variable for use with MacPorts.
### Added by the Heroku Toolbelt
export PATH="/usr/local/heroku/bin:$PATH"
### Composer Vendor Paths
export PATH="~/.composer/vendor/bin:$PATH"
### Bin Paths
export PATH="bin:$PATH"
### Vendor Paths
export PATH="vendor/bin:$PATH"
### Aliases
#
# Directories
alias partways='cd ~/Sites/projects/PartWays/'
alias trks='cd ~/Sites/projects/ThingsRichKidsSay/'
alias forrest='cd ~/Sites/projects/rest-client/workbench/omniphx/forrest/'
alias blog='cd ~/Sites/projects/blog'
alias tinynews='cd ~/Sites/projects/tinynews'
# Laravel Commands
alias art='php artisan'
alias l4project=''
# Generator Stuff
alias g:m="php artisan generate:model"
alias g:c="php artisan generate:controller"
alias g:v="php artisan generate:view"
alias g:s="php artisan generate:seed"
alias g:mig="php artisan generate:migration"
alias g:r="php artisan generate:resource"
# Node scripts
alias node_serve='node ./scripts/web-server.js'
#Git aliases
alias ggraph='git log --oneline --all --graph --decorate'
alias ga='git add'
alias gaa='git add .'
alias gau='git add -u'
alias gco='git checkout'
alias gst='git status'
alias gc='git commit'
alias gcm='git commit -m'
alias gca='git commit -a'
alias gcam='git commit -am'
alias gls='git ls-tree HEAD'
#PHPUnit
#Vagrant
alias vm='ssh vagrant#127.0.0.1 -p 2222'
#Sqlite3
alias db='sqlite3 app/database/production.sqlite'

Old thread but still relevant. It seems the only way to fix this without having to do workarounds that cause other issues, is to reinstall the OS. Its been a common issue since 2000.

By trying above steps you will solve this problem.
Delete node module of the project.
npm install
cd ios(if ios is configured)
now run your app.

Related

How to use bash aliases in a non-interactive shell?

I am using Windows 10. I followed this tutorial on how to create bash aliases. I put the aliases in ~/.bashrc, and used source ~/.bashrc afterwards. When I tried to use one of the aliases, I get the following error:
$ docs
bash: docs: command not found
I opened a new PowerShell session, used bash, tried the alias and it still gave the same error. But it only worked when I tried it on Git Bash. From what I've researched, I was opening bash in a non-interactive shell. I tried the answer on this post and put shopt -s expand_aliases at the end of .bashrc, but it still wouldn't work. This is what my .bashrc looks like:
######## Aliases #######
# Git
alias gcl="git clone"
alias gco="git commit"
alias gcom="git commit -m"
alias gpus="git push"
alias gpul="git pull"
alias gbr="git branch"
alias gad="git add"
alias gre="git restore"
alias grest="git restore"
alias gsw="git switch"
alias gst="git status"
alias gcoam="git commit --amend"
alias gcoamne="git commit --amend --no-edit"
alias gcoamm="git commit --amend -m"
# Navigation
alias home="cd ~"
alias docs="cd ~/Documents"
alias labs="cd ~/Documents/VSCode"
alias open="code ."
################
shopt -s expand_aliases # allows aliases available in non-interactive shells
How do I make the bash aliases work in a non-interactive shell?
You have to turn on this feature:
shopt -s expand_aliases

ZSH: command not found

I want to execute command gclient. I have already included its location in PATH. But I cannot directly execute it by command. Can someone tell me why?
~
❯ echo $PATH
/User/merle/depot_tools:/Users/merle/.nvm/versions/node/v11.10.0/bin:/usr/local/opt/mysql#5.5/bin:/Library/Frameworks/Python.framework/Versions/3.5/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin:/opt/X11/bin:/Library/Frameworks/Mono.framework/Versions/Current/Commands
~
❯ ls depot_tools | grep gclient
README.gclient.md
annotated_gclient.py
gclient
gclient-new-workdir.py
gclient.bat
gclient.py
gclient_completion.sh
gclient_eval.py
gclient_paths.py
gclient_scm.py
gclient_utils.py
~
❯ gclient
zsh: command not found: gclient
~
❯ cd depot_tools
~/depot_tools master
❯ ./gclient
Usage: gclient.py <command> [options]
Meta checkout dependency manager for Git.
Commands are:.......
Take another look at your path:
export PATH=/User/merle/depot_tools:/Users/merle/...
Does your system contain just 1 User or multiple Users???
It should read:
export PATH=/Users/merle/depot_tools:/Users/merle/...
i think you may forget
source ~/.nvm/nvm.sh
if you want automatically load it ,there are two ways
open ~/.zshrc
1.add
source ~/.nvm/nvm.sh
2.or add
export NVM_DIR="/Users/YOUR_USER_NAME(you need use you user name)/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm
hope this can help you
ZSH: command not found
The Problem was .zshrc, it was missing.
the solution which worked for me :
You have to create a .zshrc file.
to create use "vim .zshrc" command then insurt your path "export PATH="$PATH:pwd/flutter/bin"
save and completely exit your terminal completely. install gem cocoa pods then accept the license. you are good to go.

Laravel Homestead Per Project Install Bash Aliases Commands Not Found

I've created a per project install of Homestead. I've included after.sh (in the root directory) to provision other packages like RethinkDB with no issues, but the aliases file (also in root directory) though appearing in the VM as ~/.bash_aliases isn't running any of the aliases when I'm type them in. So for example these aliases:
alias artisan='php artisan'
alias autoload='composer dump-autoload'
In the command prompt as:
artisan migrate:refresh --seed
autoload
Throw these errors:
Could not open input file: artisan
autoload: command not found
This happens for any of the aliases I try. I've checked that ~/.bash_aliases (or /home/vagrant/.bash_aliases) exists using nano, and it is definitely a copy of aliases. Just none of the commands are being used as if it doesn't exist or as if the file though in the right spot is inaccessible.
Anyone know why? or how to fix this? It's amazing how annoying not being able to use the aliases I typically would use locally, or on global install of Homestead when using this VM.
UPDATE
I noticed I get a list of command not found errors when I SSH into the VM that equal the number of aliases I've included. The same list appears if I run source ~/.bash_aliases. For complete clarity .bash_aliases is located in /home/vagrant next to the mapped source folder /home/vagrant/app, and the output from SSHing into the VM, and the associated aliases file are included:
SSH into VM
$ vagrant ssh
Welcome to Ubuntu 14.04.3 LTS (GNU/Linux 3.19.0-25-generic x86_64)
* Documentation: https://help.ubuntu.com/
Last login: Mon Feb 15 00:37:39 2016 from 10.0.2.2
: command not found
: command not found
: command not found
: command not found
: command not found
: command not found
: command not found
: command not found
: command not found
: command not found
vagrant#app:~$
Aliases File
# Homestead --------------------------------------------------------------------
alias ..="cd .."
alias ...="cd ../.."
alias h='cd ~'
alias c='clear'
alias phpspec='vendor/bin/phpspec'
alias phpunit='vendor/bin/phpunit'
# Laravel ----------------------------------------------------------------------
# Access Artisan when within project folder
alias artisan='php artisan'
# Access Tinker when within project folder
alias tinker="php artisan tinker --env=local"
# Composer --------------------------------------------------------------------
alias autoload='composer dump-autoload'
# App -------------------------------------------------------------------------
alias app="cd app"
After.sh File
#!/usr/bin/env bash
#
# Install RethinkDB on Ubuntu
# #see https://www.rethinkdb.com/docs/install/ubuntu/
#
# Add RethinkDB repository and install
source /etc/lsb-release && echo "deb http://download.rethinkdb.com/apt $DISTRIB_CODENAME main" | sudo tee /etc/apt/sources.list.d/rethinkdb.list
wget -qO- https://download.rethinkdb.com/apt/pubkey.gpg | sudo apt-key add -
sudo apt-get update
sudo apt-get install -y rethinkdb
# Setup RethinkDB as a service using default configuration file
#sudo cp /etc/rethinkdb/default.conf.sample /etc/rethinkdb/instances.d/instance1.conf
#sudo vim /etc/rethinkdb/instances.d/instance1.conf
#sudo /etc/init.d/rethinkdb restart
# Setup RethinkDB as a service by copying the custom configuration file
sudo cp /home/vagrant/app/rethinkdb.conf /etc/rethinkdb/instances.d/instance1.conf
sudo /etc/init.d/rethinkdb restart
UPDATE 2
Nano output of .bash_aliases, which looks like my aliases file, but the output after this of alias truncates the first letter of the aliases.
# Homestead ----------------------------------------------------------------------
alias ..="cd .."
alias ...="cd ../.."
alias h='cd ~'
alias c='clear'
alias phpspec='vendor/bin/phpspec'
alias phpunit='vendor/bin/phpunit'
# Laravel ----------------------------------------------------------------------
# Access Artisan when within project folder
alias artisan='php artisan'
# Access Tinker when within project folder
alias tinker="php artisan tinker --env=local"
# Composer --------------------------------------------------------------------
alias autoload='composer dump-autoload'
Output from just typing alias into terminal:
vagrant#app:~$ alias
'lias ..='cd ..
'lias ...='cd ../..
alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"'
'lias artisan='php artisan
'lias autoload='composer dump-autoload
'lias c='clear
alias egrep='egrep --color=auto'
alias fgrep='fgrep --color=auto'
alias grep='grep --color=auto'
'lias h='cd ~
alias l='ls -CF'
alias la='ls -A'
alias ll='ls -alF'
alias ls='ls --color=auto'
'lias phpspec='vendor/bin/phpspec
'lias phpunit='vendor/bin/phpunit
'lias tinker='php artisan tinker --env=local
FINAL SOLUTION
Thanks to #JoshRumbut for solving this issue, see below for his comments.
vagrant#app:~$ tr -d '\r' <~/.bash_aliases >~/tmp
vagrant#app:~$ mv ~/tmp ~/.bash_aliases
vagrant#app:~$ unalias -a
vagrant#app:~$ source .bash_aliases
Is bash configured to look in the .bash_aliases file?
What happens if you run source ~/.bash_aliases? Do they work then?
Edit: current theory is that a weird character, possibly the carriage return (\r) is embedded in the file somewhere, as in thus question: https://unix.stackexchange.com/questions/35642/why-are-these-aliases-failing

Why is bash on Ubuntu not loading aliases correctly?

in /etc/profile.d/foo.sh I have:
set -o vi
export ECLIPSE_HOME=/usr/local/eclipse
alias eclipse=${ECLIPSE_HOME}/eclipse
After rebooting my Ubuntu 11.10 32-bit install, and after logging in from the GUI and opening a terminal as a regular user, and type alias eclipse the alias is not defined: bash: alias: eclipse: not found
If I then do sudo su - and then alias eclipse then I correctly get alias eclipse='/usr/local/eclipse/eclipse'
Just to be sure, if I then do (as root) su - myusername and then alias eclipse then I correctly get alias eclipse='/usr/local/eclipse/eclipse'
What gives?
It's better to set aliases in bashrc than in profile. profile is only read if you start a login shell. bashrc is read whenever you start an interactive shell.

how to set environment variable for root user

I'm Mac user.
I want to set PYTHONPATH env for root. so
$ sudo su -
# vi ~/.profile
and add to file 'export PYTHONPATH=/mypythonlib'
then
# env
I can see this line
PYTHONPATH=/Users/simpnet2/projects/meiji/src/hershey
but..
when I use sudo command, cannot find that
$ sudo env
.. there's no PYTHONPATH
My program has to run with sudo command and needs PYTHONPATH.
If you use sh try /etc/profile, bash try /etc/bashrc and if you use zsh try /etc/zshenv.
You can make PYTHONPATH visible to sudo be editing your sudoers file. Notice you should ONLY do this through visudo as explained here.
You should try sudo -i which will simulate logging in as root and source the ~root/.profile.
As of 10.8.5, putting my environment statements in the .profile path in the home of the root user (/var/root) worked. after quitting bash and coming back to the root user prompt with 'su -', I could see my new path, etc. with the 'env' command and my MacPorts installationw orking correctly.
MacBook-Pro:~ root# cat /var/root/.profile
export MANPATH=/opt/local/share/man:$MANPATH
export PATH=/opt/local/bin:/opt/local/sbin:$PATH
MacBook-Pro:~ root# which port
/opt/local/bin/port
Well, in other Linux system, it is also right that 'sudo' does not use local environment variable. But you can declare the temporary environment variable along with 'sudo' command.
For example, in your case, you can add 'PYTHONPATH=/mypythonlib' in your command 'sudo env', and the final command is:
sudo PYTHONPATH=/mypythonlib env
You can also read this article: Using sudo. You can see how 'sudo' keep or ignore user-defined environment variables.
In the case of logging in as a normal user and invoking "su - root" I found that Mac OS 10.8.5's bash was ignoring .profile and .bash_profile; I was unable to change root's $PATH by editing those files. What did work was editing /etc/paths. After exiting the root shell and entering again with "su - root" the new path was present.

Resources