Showing posts with label apple news. Show all posts
Showing posts with label apple news. Show all posts

How to create simple Mac apps from shell scripts

Sunday, March 18, 2012 // by Hacking Beast Editor // Labels: , , , , , // 0 comments




Basically, a Mac application has a .app extension, but it’s not really a file — it’s a package. You can view the application’s contents by navigating to it in the Finder, right-clicking it and then choosing “Show Package Contents”.
“Show Package Contents” is normally the second item, “Open” being the first.
The internal folder structure may vary between apps, but you can be sure that every Mac app will have a Contentsfolder with a MacOS subfolder in it. Inside the MacOS directory, there’s an extension-less file with the exact same name as the app itself. This file can be anything really, but in its simplest form it’s a shell script. As it turns out, this folder/file structure is all it takes to create a functional app!

Enter appify

After this discovery, Thomas Aylott came up with a clever “appify” script that allows you to easily create Mac apps from shell scripts. The code looks like this:
#!/bin/bash

APPNAME=${2:-$(basename "$1" ".sh")}
DIR="$APPNAME.app/Contents/MacOS"
if [ -a "$APPNAME.app" ]; then
  echo "$PWD/$APPNAME.app already exists :("
  exit 1
fi

mkdir -p "$DIR"
cp "$1" "$DIR/$APPNAME"
chmod +x "$DIR/$APPNAME"

echo "$PWD/$APPNAME.app"
Installing and using appify is pretty straightforward if you’re used to working with UNIX. (I’m not, so I had to figure this out.) Here’s how to install it:
  1. Save the script to a directory in your PATH and name it appify (no extension). I chose to put it in/usr/local/bin, which requires root privileges.
  2. Fire up Terminal.app and enter sudo chmod +x /usr/local/bin/appify to make appify executable without root privileges.
After that, you can create apps based on any shell script simply by launching Terminal.app and entering something like this:
appify your-shell-script.sh "Your App Name"
Obviously, this would create a stand-alone application named Your App Name.app that executes theyour-shell-script.sh script.
After that, you can very easily add a custom icon to the app if you want to.

Adding a custom app icon

  1. Create an .icns file or a 512×512 PNG image with the icon you want, and copy it to the clipboard (⌘ + C). (Alternatively, copy it from an existing app as described in steps 2 and 3.)
  2. Right-click the .app file of which you want to change the icon and select “Get Info” (or select the file and press ⌘ + I).
  3. Select the app icon in the top left corner by clicking it once. It will get a subtle blue outline if you did it right.
  4. Now hit ⌘ + V (paste) to overwrite the default icon with the new one.
Note that this will work for any file or folder, not just .app files.

Examples

Chrome/Chromium bootstrappers

I like to run Chrome/Chromium with some command-line switches or flags enabled. On Windows, you can create a shortcut and set the parameters you want in its properties; on a Mac, you’ll need to launch it from the command line every time. Well, not anymore :)
#!
/Applications/Chromium.app/Contents/MacOS/Chromium --enable-benchmarking --enable-extension-timeline-api&
The & at the end is not a typo; it is there to make sure Chromium is launched in a separate thread. Without the &, Chromium would exit as soon as you quit Terminal.app.

Launch a local web server from a directory

Say you’re working on a project and you want to debug it from a web server. The following shell script will use Python to launch a local web server from a specific directory and open the index page in your default browser of choice. After appifying it, you won’t even need to open the terminal for it anymore.
#!
cd ~/Projects/Foo/
python -m SimpleHTTPServer 8080 &> /dev/null &
open http://localhost:8080/





 The content on Hacking Beast like Hacking Articles, Cyber News etc are provided by many sources ( email,messages,internet etc) , we do not take any responsibility of your activities. The news provided by us on this site is gathered from various sources. if any person have some FAQ's in their mind they can Contact Us. and you can also read our Disclamier for more info. Thank You !
If you enjoyed Hacking Beast Articles , Make sure you subscribe to our RSS feed. Stay Updated about latest Hacking News, Tips and Tricks,and Cyber News.! and recieve all our emails and latest posts directly in your inbox to enjoy fast and easy reading . Thank You!

Steve Jobs Resignation Letter Reaches Apple BoD, CEO Bids Farewell

Thursday, August 25, 2011 // by Hacking Beast Editor // Labels: , , , , // 0 comments

steve jobs iphone 4 Steve Jobs Bids Farewell To Apple Inc. Tim Cook To Take Over As The New CEO


In a surprising move that has shaken the technology market to its core, Steve Jobs, the legendary CEO of Apple Inc. under whose guidance the company thrived into the world’s biggest technology firm has now submitted his resignation to the Apple Board of Directors. As per his recommendations, the current Chief Operating Officer (COO) for Apple Inc. Tim Cook will be taking over the affairs of the company. As of now, no concrete reason has been offered by Apple in regards to Steve’s departure. However, as the speculations surrounding the resignation of Steve Jobs point towards his deteriorating health condition. In the month of January this year, Steve had taken a medical leave to get treatment for his pancreatic cancer and it’s also being said that the cancer might have returned, forcing Steve to take this step. As per his letter to the Apple Inc. Board of Directors, Mr. Cook will now become the CEO of the company, while Steve will assume the role of ‘Chairman of the Board’.
Apple Inc. was initially founded by Steve Jobs and Steve Wozniak in the year 1976 and Mr. Jobs has served his company with utmost dedication, till the year 1980 when he was removed from  the post of CEO by the Board of Directors. However, just a decade later, Steve again assumed the role of CEO and found his beloved company in tatters, requiring immediate intervention. Under the able leadership of Steve Jobs, Apple Inc. left off its old line of products and began introducing some of the most famous Apple products such as Apple Mac, iTunes, iPod, Apple iPhone etc. As per his new role of the Chairman of the Board, Steve will be able to provide his most valuable insights into the company’s workings without being weighed down by the responsibilities of being an Apple CEO.
In letter to the Apple Board of Directors, Steve Jobs said,
“I have always said if there ever came a day when I could no longer meet my duties and expectations as Apple’s CEO, I would be the first to let you know. Unfortunately, that day has come. I hereby resign as CEO of Apple. I would like to serve, if the Board sees fit, as Chairman of the Board, director and Apple employee. As far as my successor goes, I strongly recommend that we execute our succession plan and name Tim Cook as CEO of Apple. I believe Apple’s brightest and most innovative days are ahead of it. And I look forward to watching and contributing to its success in a new role. I have made some of the best friends of my life at Apple, and I thank you all for the many years of being able to work alongside you.”



Via: email

The content on Hacking Beast like Hacking Articles, Cyber News etc are provided by many sources ( email,messages,internet etc) , we do not take any responsibility of your activities. The news provided by us on this site is gathered from various sources. if any person have some FAQ's in their mind they can Contact Us. and you can also read our Disclamier for more info. Thank You !
If you enjoyed Hacking Beast Articles , Make sure you subscribe to our RSS feed. Stay Updated about latest Hacking News, Tips and Tricks,and Cyber News.! and recieve all our emails and latest posts directly in your inbox to enjoy fast and easy reading . Thank You!