Aanpassen hosts file Mac OSX

Wanneer u bezig bent met het verhuizen van uw website en u nog niet de dns hebt aangepast kunt u de nieuwe site niet bereiken onder de domeinnaam. De dns wijst immers nog steeds naar de oude locatie.
We kunnen hier gebruik maken van het hosts file dat op zowel unix (gebaseerde) systemen linux, freebsd, macosx als op het windows platform bestaat.
Op elk unix systeem staat het hosts bestand in de /etc directory. Alleen root heeft rechten dit bestand aan te passen.
Op de Mac is het net een beetje anders.

Hier wordt uitgelegd hoe het op de Mac moet.

  1. Open je terminal: Ga naar Applicaties -> Utilities -> Terminal
  2. Typ: sudo nano /private/etc/hosts + enter
  3. Vul je wachtwoord in: het wachtwoord van je machine + enter
  4. Ga naar de laatste regel en typ: ip-adres www.domain1.tld domain1.tld
  5. Toets ctrl-X
  6. Typ Y + enter
  7. Toets: enter
  8. Typ: dscacheutil -flushcache

Uitleg van de stappen

/private/etc/hosts is het hosts bestand waar we het eerder over hadden.
nano is het tekstbewerkingsprogramma dat we gaan gebruiken om dit bestand aan te passen.
sudo zorgt ervoor dat we tijdelijk root (beheerder) rechten krijgen om het bestand aan te mogen passen.

Wanneer we op enter drukken wordt ons om een wachtwoord gevraagd. Dit is uw eigen wachtwoord. Wanneer u uw wachtwoord invult lijkt het alsof er niet op gereageerd wordt. Dit is normaal. Wanneer er toevallig iemand met u meekijkt kan deze persoon namelijk niet zien uit hoeveel tekens uw wachtwoord bestaat.

Onderaan voegen we de volgende regel toe: [het ipadres van de server waarop uw site gehost wordt] [tab] [uw websiteadres en uw domeinnaam] [tab] is simpelweg de tab-toets, maar u mag hier ook een spatie gebruiken. De regel die we dan toevoegen is:

ip-adres www.domain.tld domain.tld

Vervolgens slaan we het hosts bestand op. Druk op ctrl-X.
U wordt dan gevraagd of u het bestand op wilt slaan. Druk op Y (yes) om dit te doen.
Vervolgens ziet u de naam van het bestand getoond en drukt u op enter.
Het scherm van het tekstbewerkingsprogramma sluit.

Nu moeten we alleen nog 1 commando uitvoeren:
dscacheutil -flushcache

Voor het tijdelijk uitschakelen van de regel volstaat het ook om een # voor de regel te zetten. De regel veranderd dan in commentaar en wordt genegeerd. Het blijft echter nodig om na elke verandering dscacheutil -flushcache uit te voeren.

(Bron: ermis.nl/helpdesk/knowledgebase )

Batch rename images with a sequence on the Mac

Screen Shot 2015-07-24 at 13.29.14
Since I’m working on a MacBook Pro I’ve been missing this feature I had on a Windows machine; easy renaming images with a sequence. I used it mainly for images taken on our holidays; it was a huge batch process. I tried again finding a solution for it and succeeded and got a better solution in return 🙂

Check the article which helped me setting up a automated process with the app ‘Automator’: How To Use Automator To Batch Rename Images on Mac

List all files and folders in a certain directory with Terminal

ALL files and ALL folders

For a text file of ALL files and Folders in your Home Directory,

In Terminal, enter:
find ~ -print | sed -e 's;[^/]*/;|--->;g;s;--->|; |;g' > ~/Desktop/Tree.txt

To direct to a specific Folder, replace ~ with the Directory (i.e. find ~/Documents):
find ~/Documents -print | sed -e 's;[^/]*/;|--->;g;s;--->|; |;g' > ~/Desktop/Tree.txt

NO files and ALL folders

Before -print add
-type d
Leave spaces around it.

Listings from mounted devices

find mount/Volumes/path/to/dir -type d -print | sed -e 's;[^/]*/;|--->;g;s;--->|; |;g' > ~/Desktop/Tree.txt

source: discussions.apple.com

Mac Finder: How to batch unlock numerous files within subfolders/folders/directory

Time for some serious finder mojo:

1. Using Finder, the top level folder of those files that you want to unlock. Switch to List View mode (cmd-2).
2. You should now see a finder pane containing only those files and folders that you want to unlock.
3. Cmd-a to Select All.
4. Open all the sub-folders. With all selected, opt-command-right arrow to open up alllll the children.
5. Cmd-A to select all
6. Opt-Cmd-I to bring up the single pane inspect
7. Unlock
8. See Mason Kramer’s keyboard navigation guide for more Finder mojo.

source: forum.MacRumors.com

Tips I’ve got & found as a new Mac user

On the end of March I stepped into the other world; the one where the people are Mac-users. Since I graduated as a Graphic Designer in ’97 I’ve never been working on a Mac, not that I did not want to, it was to expensive or everybody else worked on Windows or I had to check all my development in the well known ‘always have an issue’ browsers 😉
First of all you have to get used to working on a Mac (again) and that’s not really hard, it just takes a couple of days. The best thing are the gestures/swipes to navigate through the applications and with them! I also use the shortcut keys significantly more than before.

But there are things I did not figure out by myself, although a Mac is as userfriendly as it can be 😉

  1. Show hidden files 28-03-’13
    Once and a while I need to change hidden files to get some things happen at the front-end of a website. I was taken to this article Show hidden files Mac OS X 10.7 Lion and 10.8 Mountain Lion to see them eventually.
    Update 03-04-’13: Now I think it is too much clutter in my finder and in Dreamweaver CS6 there is the option the show hidden files (). Probably I’ll undo this tip.
  2. cdtoOpen terminal in active directory 28-03-’13
    The command line is one application  I do not use very often; the commands won’t stick in my head for very long.
    I just want to open the terminal from where I am in the finder and already be in the same directory as in the finder. Using the little programme  cdto will do this for you.
  3. Switching windows within the application 02-04-’13
    Finally used to the multiple desktops and switching between them (ctrl + left or right arrows) I did not figure out yet how to activate the window that I had opened before, like a mail I had opened in Outlook: it disappeared behind the ‘main’ window. The trick to get it in front/active again is the shortcut key combination: cmd + tilde (the left key just above the cmd key)
  4. Second screen not recognized 03-04-’13
    It’s handy to use a second and bigger screen for development. Once connected my Macbook Pro recognizes it and their I have my big screen. I use the second screen as an extension of my desktop; twice as wide. But not today! I tried many options to get my screen the same resolution as my first screen… Had no luck doing it. Untill my collegue gave me a nice tip: “First open your Macbook and after that connect your second screen, not the other way around”. Disconnecting the second screen, waiting for SyncMaster to adjust and than connect it again: problem solved.
  5. .jpeg vs .jpg 03-04-’13
    Had to save a mailed image (in MS Outlook) with the extension .jpg to my local directory and it forced me to use the extension .jpeg. As a front-end developer I need to use the extensions properly in my css files otherwise the file won’t show up. This will be an extra handling that I was not used to do before (on a windows machine) and the workflow should be as smooth/quick as possible; I need this issue to be fixed. Searching for the best tip resulted in the following: “… In the aforementioned Microsoft Outlook (14.2.4) dragging and dropping a .jpg attachment to the desktop retains the .jpg extension, …“.
    source: OS X says “they standard extension is” .jpeg, but according to who?
  6. Generating SSH key 10-04-’13
  7. Clicking A Button With Your Spacebar 23-07-’13

Thanx to Onno, Maarten, Tim, Shura, Renzo  & Peter and Google