Showing posts with label mac os x. Show all posts
Showing posts with label mac os x. Show all posts

Arduino UNO Clone Serial Port CH340/CH341 Drivers for Mac OS X

Recently I tried connecting my newly purchased clone version of the Arduino UNO with the MacBook OS X Yosemite. It turns outs that, nothing gonna detect my serial port. This is because most of the clone versions are using a different chip for USB-to-Serial communication namely CH340/CH341 instead of ATmega16U2.


After hours of work and digging throughout the Internet, I found these drivers for CH341/CH340 is working as expected.

Here how you do it;


Download the drivers and install relevant setup. This package includes, drivers for linux, mac os x and windows.

Download all-in-one drivers pack

One more additional step for Mac OS X users. Disable the kext signing security setting with this command.

sudo nvram boot-args="kext-dev-mode=1"

How to test it;

on the terminal type;

ls /dev/tty*

you should see something like "/dev/tty.wchusbserial1410". In addition, if you open up your Ardunio IDE then goto Tools->Port. You should see something similar to below.




apt-get, yum install on Mac OS X : HomeBrew

This is a short blog entry on how you can invoke the the same semantic functionality you used to have in ubuntu, cent os...etc. There's a exciting project called "Homebrew" that will provide the "missing package manager for Mac OS X".

homebrew logo


You can download homebrew from this link.

Once successfully downloaded and installed; you can issue "brew install <package>" to install any package. For instance...

brew install wget

And, this is how it appears...
screen capture of installing "wget" using homebrew

Customizing the Finder in MAC OS X (Making Finder Suck Less!)

Probably MAC OS X, Finder App is one of most complained App and has always given undesirable behaviors(at least for me). There are some quick workarounds that can make your favourite Finder Application less suck.

Hope this might be more helpful for the people migrating from Windows to MAC OS;

1. How to get Address Bar / Path Bar (I am Lost! Where am I?)

Solution 1:

You can Hide/Show the Address Bar(Path Bar) using View -> Show PathBar in the Finder Application. The keyboard shortcut is to press Option[] + Command[] + [P] at once.



The expected outcome(on the bottom of the Finder):



Solution 2:

You can also just show the path in the Finder’s titlebar with these terminal command:

defaults write com.apple.finder _FXShowPosixPathInTitle -bool YES
killall Finder

The Expected outcome(on the titlebar of the Finder):

How to switch in to the middle of the path?

Solution 1:

You need to activate `Show Path Bar` for this. If you haven't activated yet; keyboard shortcut is to press Option[] + Command[] + [P] at once.

Then you can simply double click on the desired parent folder.


Solution 2:

There’s also a path button that you can add to the Finder’s toolbar. Right click on the toolbar and click “Customize toolbar. . .” Then, drag the “Path” button to wherever you want:



Solution 3:

You can also right-click on the title bar to get a path listing(see solution 2 on the previous topic to activate path on title bar).

2. Search on the current folder (WTH! These are not in my folder!)

This most hilarious feature. I don't know why they have by default enabled to search whole Mac Computer. To make it more clear... Go to any folder and search something typing on the Search box.


You will get a list of unwanted files which are also not in the folder you are currently in.

Solution:

Open Finder Preferences using "Finder-> Preferences..." from the menu. The keyboard shortcut is to press Command[] + [ , ] at once. This shortcut is common for almost all applications in Mac world. Select `Search the Current Folder` under the "When performing a search" text. Okay that's it.


Now by default you are searching on the current folder.

Mac OS X Finder and Terminal Shortcuts

These are some of simple tricks that came across when I was working with Mac OS X - Yosemite. Most of them will work with older versions such as Mavericks and Mountain Lion.


How do you navigate to the '/usr/local' from the `Finder` program?

When you open the Finder you can only navigate into limited places(figure 1).

Figure 1: `Goto` places in Finder


But for a scenario such as navigate into '/usr/local'. How do you do that? It is simple. Just type following on the terminal;

open '/usr/local'

To get to know more about `open` command goto this link or type `man open`. Then `Q` to exit from the manual.

Open current path of the terminal in Finder?

Surprisingly YES from me. You can open your current terminal path on the terminal by typing(Note the dot);

open .

Open '/usr' on the File Open Dialog?

Yes, you can use 'GoTo' feature. Just press [⌘Command]+[Shift]+[G] on the file open dialog. Then type '/usr'. Voila !!!

Get current address of a file into terminal?

Just drag and drop the file/directory you want into the terminal.

Open a file in a user-specified texteditor using terminal?

You can create an alias for saving your time! Here how to do it. 

First we need to create/edit the ~/bash_profile file. You can use any simple texteditor such as nano or vim. I am using nano. In the terminal type;

nano ~/.bash_profile

If there are any existing data, don't do any changes for those and start from a new line and type;

alias te='open -a /Applications/Sublime\ Text\ 2.app'

Notice that I am defining a alias called `te` that executes the `open -a` command. Next part is the path for your text editor. Most of the time your already installed text-editor will appeared on the /Applications folder.

In nano editor once you done with adding the text, type [control]+[O] to write-out and press [Enter] to confirm. Then [control]+[X] to exit.  

Then type;

source ~/.bash_profile

This will reload your settings in the ~/.bash_profile into current terminal emulator.

Now you can use `te ~/Downloads/sample.txt` to open the `sample.txt` using the texteditor you chose. In my case, It is Sublime 2.

Show/Hide Hidden Files in Finder?

To show all hidden files, paste this in the terminal;

defaults write com.apple.finder AppleShowAllFiles YES; killall Finder /System/Library/CoreServices/Finder.app

To hide all hidden files again, paste this in the terminal;

defaults write com.apple.finder AppleShowAllFiles NO; killall Finder /System/Library/CoreServices/Finder.app

How to fix Java Apps Getting Blurred on Retina Displays MAC OS X

Have you experienced this too???. My MacBook was shipped with JDK 1.6.0. So I installed JDK 1.7u07. Soon after I realized that all java based applications(or running on the newer JVM) are getting blurred. Look closer on these two images;

`Android Studio` on JDK 1.7u07;


`Android Studio` on JDK1.7u40;

It is negligible, isn't it???

Of course it is not a big issue but having eyes on the screen for long hours will be definitely yelling; "There is something....!!!". So I decided to dig into the problem and found out, that is because JDK 1.7 support issue.

AWT/ Swing under the JDK 1.7(as before 1.7u40) had an issue with HiDPI displays. HiDPI (High Dots Per Inch) also known as Apple's "Retina Display" marketing name, which are screens with a high resolution in a relatively small format[1].

So What is the Solution???




According to this change log it is been fixed on JDK1.7u40. HiDPI or retina support is available on [2];
  • Java 6
  • Java 7u40ea or greater
  • Java 8
So the solution is to upgrade you current JDK into one of above matching criteria. 

Have a Happy Coding Day !!! 

Links
[1] https://wiki.archlinux.org/index.php/HiDPI
[2] http://stackoverflow.com/questions/15181079/apple-retina-display-support-in-java-jdk-1-7-for-awt-swing

Syntax Highlighting bash terminal and vim in Mac OS X

So far I was not a huge Apple fan. However, recently I received a MacBook Pro(Amazing Huh!). In Mac OS X; your default terminal shell is bash. But the Terminal itself put a burden on me; Unlike it is in Ubuntu or Cent OS; the folders and files names...etc are not color coded ending up frustrating. 

Here is how I made it colorful :P

STEP 1: 
Open up your terminal. You can simply press [⌘Command]+[SpaceBar] to appear 'Spotlight Search' and type 'terminal' and hit enter.

 
STEP 2:

type "cd ~" and hit enter.

This will change the current directory into your home directory.

STEP 3:

type "vim .bash_profile".

This command will open ".bash_profile" in vim editor. vim is a CLI based text editor.

STEP 4:

Hit [i] to enter into --INSERT-- mode. This will enable you to insert new characters into the document. If there '.bash_profile' is not existed before; 'vim' will create a new one for you and it will appear empty. Otherwise; make sure you are not changing other settings in the file.

After entering --INSERT-- mode; type the following;


export CLICOLOR=1

STEP 5:
Enter [Esc] to exit from --INSERT-- mode. Then type ":wq" and hit enter.

":wq" -> will write and quite from the vim
":q!" -> will exit without saving your changes(If you did something wrong!)

STEP 6:
In the terminal; enter "source .bash_profile".

This will apply configurations into the current bash shell. Or you can skip this step and re-open the terminals.

STEP 7:
Now type "ls -l" you will experience it ! Enjoy !!!



BONUS:
If you need to highlight syntaxes in the vim editor as well; follow the same steps to edit the file. Simplest way is to create a file in '~/.vimrc'. 

So your command would be "vim ~/.vimrc" and enter the following;

filetype plugin indent on
syntax on