Pop-Up Alert in Command line using AppleScript

You can open pop-up alert in command line using AppleScript.

Let Finder or System Events display dialog like this:[ref]StackOverflow: How do I make a Mac Terminal pop-up/alert? Applescript? [/ref]

osascript -e 'tell app "Finder" to display dialog "Hello World"' 
osascript -e 'tell app "System Events" to display dialog "Hello World"'

You can get the return response like this, too [ref]Displaying a dialog box using terminal commands[/ref]

x=`/usr/bin/osascript <<EOT
tell application "Finder"
	set myReply to button returned of (display dialog "Here is a dialog box" default button 2 buttons {"button one", "button two", "OK"})
end tell
echo 'Button is: '$x
if [[ $x = "OK" ]]; then 
echo 'Shell script continues...'
# Your
# Code
# Here
echo 'Script ends.'

What is tilde (~) in Mac/Linux?

The tilde(~) expansion in Mac/Linux has several pathnames.[ref]GNU Bash: Tilde Expansion[/ref][ref] The Magic ~: Bash Tilde Expansion with 5 Examples [/ref]

  • It could be ${HOME} if you do not specify the username.
    If you specify the user, it will expend the home directory of the user.
    For example,

    $ echo ~
    $ echo ~otheruser
  • It contains the working directory by +/-
    For example,

    $ echo ~+
    $ echo ~-

In shell, if you want to expand it,

EXPAND_PATH=`eval echo ~otheruse/bin/`

How to add personal git repository in a web hosting server

The most useful site for the topic is http://www.mobiphil.com/2010/03/git-on-shared-hosting-with-git-http-backend/.

If your web hosting server does not have git, you can just manually install the git. (I don’t want to describe this at this posting.)

1. Prerequisite

Check following CLI commands are available in the server


2. The goal

Here is the one that I want to achieve.

  • ${HOME}/git_projects in the server
    • This is the actual git repositories such as xxx.git, yyy.git, etc.
  • ${HOME}/public_html/git in the server
    • This is the http address that a user can access
  • A user can use the http address with proper userID and password

3. ${HOME}/git_projects in the server

Do this:


cd ${HOME}/git_projects
mkdir xxx.git
cd xxx.git
git init –bare –shared=all
touch git-daemon-export-ok


Now, the xxx.git is ready to use.

4. ${HOME}/public_html/git in the server



Options +ExecCgi
AuthName "Private Git Access"
AuthType Basic
AuthUserFile ${HOME}/public_html/git/.htpasswd
Require valid-user
RewriteEngine on
RewriteBase /
SetHandler cgi-script
RewriteRule ^([a-zA-Z0-9._]*\.git/(HEAD|info/refs|objects/(info/[^/]+|[0-9a-f]{2}/[0-9a-f]{38}|pack/pack-[0-9a-f]{40}\.(pack|idx))|git-(upload|receive)-pack))$ ./git-http-backend.sh/$1




#first we export the GIT_PROJECT_ROOT
export GIT_PROJECT_ROOT=${HOME}/git_projects
#and run your git-http-backend

#uncomment the following line if you want to see environment variable values


The git-http-backend.sh should have +x permission.


You need to create it by yourself. http://www.htaccesstools.com/htpasswd-generator/ is a good site to create the .htpasswd.

5. Client

Create a directory and get the repository. And, git push at the end. Here is showing an example.


mkdir ~/tmp
cd ~/tmp
git clone http://[ID]@git.example.com/xxx.git
cd xxx
…(modify or add files)
git add .
git commit -m "Initial Commit"
git push origin master


Note that “git clone http://[ID]@git.example.com:cgi-bin/xxx.git” will ask you password.

Also, after this, other user can clone the repository by git clone http://[ID]@git.example.com/xxx.git in anywhere, and “git push” and “git pull” can be used.

6. Other notes

From time to time, you may encounter 403 error. In this case, you need to check .htaccess in the root web site directory (normally, ~/public_html/.htaccess) to check if it has like this:


<Limit GET POST>
order deny,allow
deny from all
allow from all