mac os x

How to install Android on VMware Fusion Mac OS X

It’s very interesting that you can actually boot Android on your machine just like any other OS. No kidding, as Android is kind of an another Linux Distro. Is it? No not really, it is based on Linux kernel but it cannot be called as a Linux distribution. Anyways, this is not our topic of blogpost right now, if you want more information on it, look at this Quora question and their answers.

Coming to our topic of interest, one need to have VMware Fusion or a Virtual Box installed on your Mac to install and run Android. We are not going to deal with the Virtual Box this time, it would be a good standalone post for future. So, if you don’t have VMware Fusion, download and install it by going here. It is paid, if you are a student, you can get it for free. If not, you have to purchase it or you can try the trial version or maybe you could torrent it, haha. No, please don’t do that. Who am I kidding, LOL.

Once you got it on your machine. I would like you to visit this amazing site called as android-x86.org, where you can download any version of Android iso images. Hats off for their amazing effort. Very recently, they even added the Android 5.1 too. I haven’t tested that one yet, but I tried playing around with the other latest versions.

Click on the Download page from the side menu, and you can download any of those images from the list. In this post, I am going to show the installation of android-x864.4-r2.iso. 

android-x864.4-r2.iso Download Link

Download the image from the highlighted link as shown in the above picture.

Now, fire up the VMware Fusion on your machine,

Step 1: Click on the “+” button and select New from the drop down menu.

New

Step 2: Select the Installation Method as “Install from disc or image” and hit continue

Installation Method

Step 3: Now, click on the “Use another disc or disc image button” and choose the downloaded android iso file.

File Chooser

Step 4: After choosing the image, it should show up in the screen like the following: Hit Continue.

File Image

Step 5: You should see the following screen:

Finish Screen

Step 6: Click on the “Customize Settings” button and Save the Virtual Machine image to any desired location on your machine:

Save VM Image

Step 7: Once you save it, there will be two screens which will pop up, a black screen with a play button, and the other with settings:

Play Screen

Settings

Step 8: On, the settings screen, select Hard Disk and set it to how much space you wanna allocate: [I chose the default 20 GB space]

Hard Disk Space

Step 9: Select the processors and memory. It will allow you to allocate the RAM for the OS. I gave something above 4 GB, you can set it to 1 or 2 or 3 based on your RAM.

RAM

Step 10: After setting the memory, close the window and click on the huge play button on the black screen. That should show you the following screen:

Main Screen

Step 11: Select the last option – “Installation – Install Android-x86 to harddisk” from the boot menu and hit enter.

Screen - boot menu

Step 12: Now, we have to create a partition. You might see only two options. Don’t worry about it. Choose the “Create/Modify Partition“.

Create/Modify Partition

Step 13: We don’t want any GUID Partition Table. So, select the default choice which is “NO” and move on.

GPT

Step 14: Now, choose the “New” from the bottom menu. You can navigate through those options by using right and left keyboard keys. Press Enter.

New Partition

Step 15: Select “Primary” and hit enter.

Primary

Step 16: Now, you will see the size of the primary partition as 21,467.68 as I have selected 20 GB at the start of our installation. If you have chosen different size, the value would be different. Just hit enter and proceed.

Size

Step 17: Now, choose the “Bootable” which is the default option and hit Enter.

Bootable

Step 18: Now, you should see “Boot” under the Flags  as shown in the below picture.

Boot Flag

Step 19: As we have made the disk bootable, we have to write these settings to the partition. So, choose Write by navigating with the keys and hit Enter.

Write

Step 20: Now, last step is to confirm and to create a new partition. Type “yes” and hit Enter.

Yes

Step 21: Now, navigate to the Quit option in the menu and hit Enter.

Quit

Step 22: Its time to select our created partition from the menu and hit enter.

Partition select

Step 23: Now, select the filesystem for the created partition. Choose ext3 and hit Enter. You can even choose other options too if you need.

ext3

Step 24: Select “yes” from the menu and hit enter to confirm that you want to choose ext3 and format the partition. sda1 format

Step 25: Now, choose “Yes” to install GRUB boot loader and hit “Enter”.

GRUB

Step 26: Choose “Yes” to install EFI GRUB2 and hit Enter.

GRUB2

Step 27: Select “Yes” and hit Enter to confirm the format of boot partition.

confirm boot

Step 28: Choose “Yes” to install the /system directory and hit Enter.

/system directory

Step 29: You should see the installation progress bar like the following:

Progress bar

Step 30: You should see the Congratulations screen. Choose “Run Android-X86“.

Run Android

Now, you should see the Android booting up and the “ANDROID” splash screen. Your mouse or trackpad can be used to navigate through the whole user interface. The following are the screens after the android has been booted up on the machine. You have to also, enter your google email id and go through the step by step process of setting up your device.

Screen Shot 2015-10-12 at 1.25.08 PM Screen Shot 2015-10-12 at 1.25.38 PM Screen Shot 2015-10-12 at 1.27.23 PM Screen Shot 2015-10-12 at 1.27.43 PM Screen Shot 2015-10-12 at 1.29.26 PM Screen Shot 2015-10-12 at 1.30.19 PM Screen Shot 2015-10-12 at 1.30.40 PM

ENJOY 😀

-SH

Importance of /var folder in MacOSX

Hi Mac Users,

varis one of the most important directory on the Mac OS.

Importance of var folder:

  • /var – This is actually a hidden folder in mac! Until and unless you make your mac to show the hidden files, this file will not be visible. This is actually under the /private/var.The directory which you see is the shortcut.It is just a symbolic link.Now lets see what is its significance! The folder contains the processes controlled by the operating system.Processes like printing and the programs that store the log files will use the sub directories in the /var directory to store those files.It also holds a fair bit of configuration information [especially /var/db]
  • /var/backups – Used to store backups of critical system information.
  • /var/db – Holds various databases of the system information.The most notable are the netinfo databases(stored in /var/db/netinfo), shadow password files(in /var/db/shadow/hash),and the system’s network configuration database (/var/db/SystemConfiguration/preferences.xml although it moved to /Library/Preferences/SystemConfiguration/ in 10.6), which together store much of the system and network configuration information that a traditional unix admin would expect to find in /etc, and a Mac OS 10 admin would expect to find in System Folder:Preferences.
  • /var/log – This is where many of the system event logs are kept (others are kept in /Library/Logs).
  • /var/root -The root (superuser) account’s home directory. Note that this directory will exist even if you haven’t enabled the root account.
  • /var/run – Stores various status information about processes (especially daemons) running on the system.
  • /var/tmp – A place for programs to store temporary data, just like /tmp. Some programs use one, some use the other, so Mac OS X provides both.
  • /var/vm – Used to store the swap files for Mac OS X’s virtual memory.
  • /var/vm/app_profile – Holds information about various applications’ virtual memory usage.

Never delete this directory because it leads to many severe problems such as data loss and non functionality of your applications! Check out the post in case if you have deleted the /var folder accidentally.

 

How to view hidden files on Mac

Viewing hidden files on Mac is useful for accessing the hidden files on UNIX.Additionally if a folder is prefixed with a ‘.’  it is considered as a hidden file.

To view hidden folders:

  •     Open Terminal and type defaults write com.apple.finder AppleShowAllFiles -bool true and press return to execute the command.
  • For the changes to take effect, just terminate the finder by opening the Activity Monitor and quitting the Finder process.
  • Reopen the finder to see your hidden files!
  • Instead of going to the Activity Monitor ,you can execute the command killall Finder in Terminal or simply by right clicking on the Finder icon on the Dock and by selecting the Force Quit option.

To Hide the Files:

  •       Open Terminal and type defaults write com.apple.finder AppleShowAllFiles -bool false and press return to execute the command.
  • Force Quit and reopen the Finder by following the above steps to hide your folders. 🙂

How to convert a .doc/.docx file to pdf in Mac OS X.

Unlike Windows,there is no need to install a doc to pdf converter software in Mac OS X as the PDF converter comes with the bundle of the Mac OS X software.

It’s a piece of cake to convert a .doc/.docx file into a pdf file on Mac OS X.

  • Just open up the file(.doc/.docx/.rtf/.txt etc.) in any text editor (Text Edit,Text Wrangler,MS WORD,Pages,Open Office.Org ,Libre Office etc.)
  • Click on the File Menu and select the Print option (File->Print..) or simply use the handy short cut Command+P, this will drop a new window as shown in the snapshot below.

  • Now click on the PDF button which is provided at the bottom left of the window.This will populate a menu which looks like the following:

  • On selecting the Save as PDF option from the menu, it will show you an another window as shown in the following snapshot:

  • Give your desired file name and choose your location and press “save” to save your file.
  • Now you are done ! You have converted a file into a PDF(Portable Document Format). 🙂

“Failed to load JavaHL Library”!-A Disastrous Error

One may get the following error message while installing Subclipse plugin in Eclipse on Mac OS X.

Failed to load JavaHL Library.
These are the errors that were encountered:
no libsvnjavahl-1 in java.library.path
no svnjavahl-1 in java.library.path
/opt/local/lib/libsvnjavahl-1.0.0.0.dylib:  no suitable image found.
Did find:  /opt/local/lib/libsvnjavahl-1.0.0.0.dylib: mach-o, but wrong architecture
This error usually occurs when you are trying to install the subclipse on the 64-bit machine.(This error doesn’t occur if you are using 32-bit machine).
The above error flashes on your screen due to the following reason:
This is because the 64-bit JVM cannot load a 32-bit native library. The CollabNet binaries for OSX do    not have this problem because they include both 32-bit and 64-bit versions.
Solution: Goto this link and download the correct Universal Subversion Binaries file.
For instance if you are using Snow Leopard,then you might probably download the file with “Universal Subversion 1.6.17 Binaries for Snow Leopard (Mac OS X 10.6)” as header.
Unfortunately to download these binaries,you need to register with the CollabNet which is rather painful.This binary package installs the JavaHL.
After downloading the package install it by double clicking the .pkg file.As usual,the installation steps are uncomplicated.
This file creates a folder with “subversion” as name in the “opt” folder. Usually the path would be /MacintoshHD/opt/subversion.
Next step is to update your ./bash_profile file with the following line:
   export PATH=/opt/subversion/bin:$PATH
After you have updated the file close the terminal and then open a new one again.Make sure that you are using the latest version of the Subversion.
You can check this by executing the following line in the terminal:
 svn –version
This should show you something like this :
Image
To test the JavaHL library you can download the javahltests.jar from subclipse.tigris.org
Now Restart your Eclipse and you are done.No more warnings.You can verify that you have got the right version of JavaHL installed  by going to Eclipse->Preferences->Team->SVN.
Under the Svn Interface you will see the version of your JavaHL installed.
Sometimes in the worst situations ,even though you have installed the binaries and Subclipse plugin properly, the Eclipse may give error when you go onto Eclipse->Preferences->Team->SVN as following:
Failed to load JavaHL Library.
These are the errors that were encountered:
no libsvnjavahl-1 in java.library.path
no svnjavahl-1 in java.library.path
Native Library /opt/subversion/lib/libsvnjavahl-1.0.dylib already loaded in the other classloader
/opt/local/lib/libsvnjavahl-1.0.0.0.dylib:  no suitable image found.
Did find:  /opt/local/lib/libsvnjavahl-1.0.0.0.dylib: mach-o, but wrong architecture
If you observe carefully , you would find a new line which is added up to the error message which is
Native Library /opt/subversion/lib/libsvnjavahl-1.0.dylib already loaded in the other classloader
Reason:This occurs if you have already installed the other subversion plugins in your eclipse environment which is preventing  the actual subclipse plugin to load the javaHL library as it is getting loaded in the other subversive plugins. At this point if you goto Eclipse->Preferences->Team->SVN you would find “javaHL not connected” under the Svn Interface.
Solution:When you are installing subclipse plugin in your eclipse environment, make sure that there are no pre installed svn plugins in your eclipse.It would be always better to install the subclipse plugin into an empty eclipse environment which makes your work simple.
Now if you check the Eclipse->Preferences->Team->SVN you would find it as following:
Image

How to Edit/Change the PATH Environment Variables Mac OS X

It’s very trouble-free task to edit/ change the path environment variables on Mac OS X.

The recommended way is by editing your .bash_profile  file.This file is read and the commands in it are  executed by bash every time you log in to the system.The best part is that this file is specific to your user so you won’t affect other users on the same system by changing it.

Step 1: Open up a Terminal window (this is in your Applications/Utilites folder by default).

Step 2: Enter the following command:

              open ~/.bash_profile

This will open the .bash_profile file in TextEdit(the default text editor included on your Mac). This file allows you to customize the environment your user runs in.

Or

   you can enter the following command:

             edit .bash_profile

This will open the .bash_profile in TextEdit or TextWrangler whose contents can be edited as you like.Also you can use

cat .bash_profile which will output the contents of the file directly into the terminal window so that you can review it.

Note: With cat command you cannot edit the file but you can have a look at the contents.

Step 3:Add the following to the end of the file adding whatever additional directory you want in your path:

For instance, export PATH=”$HOME/.rbenv/bin:$PATH”

This example would add ~/.rbenv to the PATH.The $PATH part is very important as it appends the existing PATH to preserve it in the new value.

Step 4: Save the .bash_profile file and quit (Command+Q) TextEdit or TextWrangler in this illustration.

Step 5: Force the .bash_profile to execute.This loads the values immediately without having to reboot.To execute the file ,run the following command in your terminal window.

        source  ~/.bash_profile

That’s it!Mission accomplished and now you know how to edit/change the PATH on your Mac OS X.

Step 6: You can confirm the new path by executing the following command:

echo $PATH

Now you will see the changes which you have made.

Mistakes one can make while following this process:

If you type ~/.bash_profile in your terminal window you would land on this following statement which says

-bash: /Users/<your username>/.bash_profile: Permission denied

It’s saying ‘permission denied’ because you are trying to run the .bash_profile as a command.When you type ~/.bash_profile you haven’t given it a command to execute against the file.

As the filename starts with the ‘.’ ,it is a hidden file.In terminal if you type ls -la it will give you a listing with all the files in a directory with a long format which provides more information about the files including the ownership privileges including all the hidden files.

So beware of making such a mistake! Have fun 🙂

Installing Tomcat 7.0.x on Mac OSX

ImageImage

Tomcat 7 is the first Apache Tomcat release to support the Servlet 3.0, JSP 2.2, and EL 2.2 specifications. Please note that Tomcat 7 requires Java 1.6 or better, but that shouldn’t be a problem, if you are running OS X 10.5 or 10.6.

On OS X 10.7 (Lion) however, Java is initially not installed anymore. You can find the installer on Apple’s support side here or follow this installation guide, provided by Adobe. Whatever you do, when opening Terminal and running java -version, you should see something like this.

java version “1.6.0_29”
Java(TM) SE Runtime Environment (build 1.6.0_29-b11-402-10M3527)
Java HotSpot(TM) 64-Bit Server VM (build 20.4-b02-402, mixed mode)

Here are the effortless steps which should be followed to get your Tomcat Server running on your Mac.

Step 1: Download a binary distribution of the core module: apache-tomcat-7.0.26.tar.gz from here. I picked the tar.gz in Binary Distributions / Core section.

Step 2: Opening or Unarchiving the tar.gz file will create a folder something like this in your Downloads folder ~/Downloads/apache-tomcat-7.0.26

Step 3: Move the unarchived distribution to /usr/local

             sudo mkdir /usr/local

             sudo mv ~/Downloads/apache-tomcat-7.0.26  /usr/local

Step 4: To make it easy to replace this release with future releases, we are going to create a symbolic link that we are going to use when referring to Tomcat:

sudo ln -s /usr/local/apache-tomcat-7.0.26  /Library/Tomcat

Step 5: Change ownership of the /Library/Tomcat folder hierarchy:

sudo chown -R <your username>  /Library/Tomcat

Step 6: Make all scripts executable:

sudo chmod +x /Library/Tomcat/apache-tomcat-7.0.26/bin/*.sh

This command executes the startup.sh which starts the tomcat server.

Step 7: Now open your Web Browser and goto http://localhost:8080

You should see the following window.

Image

Instead of using the start and stop scripts, like so:

Last login: Sun Mar18 09:00:18 on ttys000

Zerocools-Macbook:~ zerocool$ /Library/Tomcat/apache-tomcat-7.0.26/bin/startup.sh
Using CATALINA_BASE: /Library/Tomcat/apache-tomcat-7.0.26
Using CATALINA_HOME: /Library/Tomcat/apache-tomcat-7.0.26
Using CATALINA_TMPDIR: /Library/Tomcat/apache-tomcat-7.0.26/temp
Using JRE_HOME: /Library/Java/Home
Using CLASSPATH: /Library/Tomcat/apache-tomcat-7.0.26/bin/bootstrap.jar:/Library/Tomcat/apache-tomcat-7.0.26/bin/tomcat-juli.jar
Zerocools-Macbook:~ zerocool$ /Library/Tomcat/apache-tomcat-7.0.26/bin/shutdown.sh
Using CATALINA_BASE: /Library/Tomcat/apache-tomcat-7.0.26
Using CATALINA_HOME: /Library/Tomcat/apache-tomcat-7.0.26
Using CATALINA_TMPDIR: /Library/Tomcat/apache-tomcat-7.0.26/temp
Using JRE_HOME: /Library/Java/Home
Using CLASSPATH: /Library/Tomcat/apache-tomcat-7.0.26/bin/bootstrap.jar:/Library/Tomcat/bin/tomcat-juli.jar
Zerocools-Macbook:~ zerocool$

You may feel this as a very tedious method.So you can make this process uncomplicated by using an magnificent app which is known as Tomcat Controller.This app provides a simple start and stop button to start and stop the Tomcat server.

ImageImage

By default the Tomcat home directory is set to /usr/local/tomcat. This may not work as your tomcat is located at /Library/Tomcat/apache-tomcat-7.0.26. Change the Tomcat home directory in preferences to your own location of tomcat on your mac and have fun!