Showing posts with label terminal. Show all posts
Showing posts with label terminal. Show all posts

Thursday, 30 October 2014

transfering music from ipod to itunes on OS X

So you have your music on you iPod and now you want to transfer it to another iTunes library for free?

Solution:

  1. Download iExplorer
  2. Load it up and right click and "mount" iPod
  3. load up terminal and type:
    1. defaults write com.apple.finder ShowAllFiles YES
  4. go to the apple at top left > Force Quit ...
  5. Click on finder and "Relaunch"
  6. Load up a new Finder window, go to the iPod > iPod_Control > Music
  7. Copy the Music Folder to your desktop
  8. load up "Terminal" again and type:
    1. chflag nohidden ~/Desktop/Music
    2. chflag nohidden ~/Desktop/Music/*
  9. Now you can load up iTunes and copy the music folder onto it
  10.  Sorted!
  11. Oh, you probably want to not show hidden files anymore so type:
    1.  defaults write com.apple.finder ShowAllFiles NO
Cheers

Wednesday, 15 October 2014

OS X Mavericks - No disk space on startup disk - files that can be deleted

After re-imaging a new Macbook Pro 13", I discovered that it only had a 120GB Hard Drive. The Disk Image I use takes up all of this space, so files have to be deleted. The applications that take the most disk space are:

Soundtrack Pro Loops
DVD Studio Pro Content
Motion Content
LiveType Content
Logic Content

so, after imaging these machines type this in to remove these things:

rm -R /Volumes/Macintosh\ HD/Library/Audio/Apple\ Loops/Apple/Apple\ Loops\ for\ Soundtrack\ Pro/
rm -R /Volumes/Macintosh\ HD/Library/Application\ Support/Final\ Cut\ Studio/DVD\ Studio\ Pro/
rm -R /Volumes/Macintosh\ HD/Library/Application\ Support/Final\ Cut\ Studio/Motion/         
rm -R /Volumes/Macintosh\ HD/Library/Application\ Support/LiveType/
rm -R /Volumes/Macintosh\ HD/Library/Application\ Support/Logic/

Should make about 57.05GB

As the MacBook Pro is for a manager, these applications arent' needed.

Monday, 6 October 2014

Apple Remote Desktop ARD preferences and presets transfer

It's always good to have a backup of all the preferences and tasks you have saved in ARD. I thought I had it sussed,  just need the file:

~/Library/Prefeences/com.apple.remotedesktop.plist

Turns out as of version 3.7 it's all been 'sandbox'ed. That means these prefences files have been moved to:
~/Library/Container/com.apple.remotedesktop/Library/Preferences/com.apple.remotedesktop.plist

But not only this, it has to have the right ACL's (permissions)

What I tried to do is copy this file between accounts and it ended up replacing the copied file with a blank one every time. It wasn't until I read this post which mentioned resetting ACL's. THis is the command they suggested using:

{ sudo chflags -R nouchg,nouappnd ~ $TMPDIR.. ; sudo chown -R $UID:staff ~ $_ ; sudo chmod -R u+rwX ~ $_ ; chmod -R -N ~ $_ ; } 2> /dev/null
So first I copied the com.apple.remotedesktop.plist file to  
~/Library/Container/com.apple.remotedesktop/Library/Preferences/com.apple.remotedesktop.plist

I then ran the command in terminal.

Then I logged out and back in again.

Crash bang wollop it worked.

Cheers

Friday, 25 April 2014

Turn off indexing (spotlight)

Just trying to get Mavericks server working, and logged in as an Active Directory user on it. Seems mds_stores is using a large amount of processing. found this post which says to turn it off, in terminal type:

sudo mdutil -a -i off



This is the message in terminal I got when I typed the command in:


/:
Indexing disabled.
/Volumes/Scratch 1:
Indexing disabled.
/Volumes/Scratch 1/Home Folders:

Indexing disabled.

Might be to do with the fact I was trying to get home folders working, something to do with profile manager. Anyway, the command did stop the large processing.

Monday, 10 March 2014

OS X Mavericks and Active Directory Home drive problems (NHR)

So, I'm going to document what problems I currently have with Active Directory home drives stored on windows SMB shares.

In the past when we put our macs on the active directory logins, I always untick the "Force local home" in the active directory options. The main reason is so that users take with them all of their account settings and preferences where-ever they login. This does however come with problems. It seems the mounted home drive has some permission issues which some applications have real problems with.

In the past I have installed Network Home Redirection (NHR). At login, this script runs whenever it detects the user to be a network user. It then creates a local temporary folder and creates alias' from particular folders on your home drive to the local folder. From the perspective of an application running, it thinks that these folders are normal local folders which they tend to prefer.

The default NHR setup redirects folders of known problems in OS X 10.6. But I don't think it is updated anymore. I have been constantly adding and taking away folder re-directions for the application we use in the computer suites.

Here I shall document current problems with network home preferences where NHR has worked.

Adobe Acrobat Pro 9
Seems to Crash when opening a document
Redirected folder: ~/Library/Application\ Support/Adobe/Acrobat
Seems to have fixed the crash

Monday, 13 January 2014

Find the IP address of a computer with know MAC address (ethernet ID)

So, on my server it is reporting an issue with a computer with MAC address AA:BB:CC:DD:EE:FF (obviously I made this one up).

Trouble is, I know this computers MAC address but not it's IP address. So how do you find it?

Well, found this forum and this forum which basically tells you to use the command 'arp':

arp -a | grep "AA:BB:CC:DD:EE:FF "

arp lists all MAC address of computers on your subnet. But it's taking a long time. Reading more in the forum it looks like it works by pinging all the IP addresses, then asking it for it's MAC address. Long winded!

Tuesday, 17 December 2013

installing iLife through Apple Remote Desktop Task Server

So, I need to install iLife '09 through ARD Task Server on 17 machines. When install the iLife '09.mpkg file from my machine straight to one machine it works fine. If I give it the option to use the task server it comes up with:
Completed but failed on 1 package ""

In console on that machine I found this line:

17/12/2013 16:03:26.476 com.apple.RemoteDesktop.agent: iLife09.mpkg/Contents/Installers/iPhoto.mpkg/Contents/Installers/iPhotoContent.pkg/Contents/Archive.pax.gz: (Empty error message)


I tried renaming the mpkg file so as not to have the '09 but did not effect it.

I'm now trying it from the command line. The plan is to just send some commands to the machine to mount the server share, and run the installer:

mkdir /Volumes/YourTMPFolder
mount -t afp afp://admin:yourPassword@your.server.here/YourShare /Volumes/YourTMPFolder
installer -package /Volumes//Volumes/YourTMPFolder/iLife09.mpkg -target /
umount /Volumes/YourTMPFolder

Works perfectly!


Tuesday, 15 October 2013

Deleting 'forced' local home folders created from OS X 10.7 Active Directory Logins

When users log in to the apple macs at the college it creates a local home on the machine to save preferences and files, and mounts their home drive too.

After a year these fill up. After a few searches and researches, looks like the easiest way is to write a script which deletes all folders except certain ones. Looks like you can use the 'find' command. Found a good example here:


find . -maxdepth 1 -not -name 'filename.gif' -iname '*.gif' -delete

Here's the man page for find

So, I don't want to delete the folders:
Guest
Shared
administrator
media

So:
find . -maxdepth 1 -not -name 'Guest' -not -name 'Shared' -not -name 'administrator' -not -name 'media' -name '*' -delete
I tried '*.*' but it only then deletes files with '.' in them, not folders. '*' selects everything including folders

Actually, I found here that the slightly better way to do it was to use the -exec rm instead of -delete. This then tells you which directories were actually deleted:
find /Users/Shared -maxdepth 1 -mindepth 1 -not -name 'administrator' -not -name 'Guest' -not -name 'Shared' -not -name 'media' -exec rm -Rvf {} \;
The -mindepth 1 option makes sure it doesn't delete the parent directory.

A longer term solution would be to delete these folders on logout, so the students and staff could get used to not relying on these folders.

Friday, 19 July 2013

Getting Mac Model Identifiers using Command Line and ARD

I remember a few years ago ARD used to tell me the Mac Model Indentifier e.g. iMac12 ,2

Apparently not any more. I found this forum where they've found a command line argument which prints it:

system_profiler SPHardwareDataType | grep "Model Identifier" | awk '{ print $3; }'

This worked, although the machines needed to be switched on to find it. I wonder why Apple never kept this feature in ARD?

Thursday, 30 May 2013

Google Chrome downloads are invisible to Finder on OS X

For some reason whenever I download a file using Google Chrome on OS X I cannot see the file in the downloads folder. The only thing I've done is changed the default download folder to another location. I have noticed that the file is actually there using the 'ls' in terminal. Also, I can open the file from within Google Chrome.

Very odd, but I've had a look into it and found the hidden chflag which hides files from the finder. It's used so that people don't see and interfere with files they're not ment to.

A quick fix (but which I don't like) is to make all hidden files viewable from Finder. To do this open terminal and type:
defaults write com.apple.finder AppleShowAllFiles TRUE

It's very ugly because all I want to do is see the downloads which are hidden, not every file. They're made invisible for a reason.

Looking more into it, it turns out that files can be flagged up as 'hidden'. This makes them invisible. So to make files hidden or not hidden in terminal you type:
chflags nohidden afilethatishiddenforexample.txt

or to make it hidden again:
chflags nohidden afilethatisnothiddenforexample.txt

Think I'll just have to log out and back in again to fix Google Chrome properly.

Saturday, 20 April 2013

enabling and installing pureftpd on Mac OS X 10.7

So, my computer is also acting as a web development server. As such, I'd like to access the files from anywhere so I decided I'd like something like FTP setup. But reading the forums FTP is a big no-no. Which is probably why Apple switched it off for OS X 10.7.

So, what are the alternatives:
PureFTPd

But how to install? Well, it needs to be compiled and then installed. Found the process here on an Apple Forum 3rd one down. He states:

find /usr/local -type f -name 'pure-*' | tar -czf pure-ftpd_backup.tgz -T -

tar xzf pure-ftpd-1.0.32.tar.gz
cd pure-ftpd-1.0.32
./configure --with-everything --with-tls --with-certfile=/etc/pure-ftpd/ssl/pure-ftpd.pem --sysconfdir=/etc/pure-ftpd/ --with-sysquotas --mandir /usr/local/man --with-pam --with-virtualchroot  --with-peruserlimits --with-ldap --with-rfc2640
make
sudo make install-strip
cd ..
rm -r pure-ftpd-1.0.32.tar.gz pure-ftpd-1.0.32
After this you can install PureFTPd Manager which should provide you with a GUI, although it states it works for OS X 10.6. Apparently works for 10.7.

Seems to work alright, although I'll have to read up about changing ports and setting up sftp stuff

Tuesday, 26 March 2013

installing Octave on Mac OS X 10.6 and 10.7

So, just read the wiki here. As it's open source, they havent yet made a pkg installer for it. Apparently, the best thing to do is to use a Package Manager to install it for you.

I've just tried Fink but the website isn't working. Looks like they've moved their website to http://fink.thetis.ig42.org/. Apperantly there's no pkg installer for this either! Here's the download for the binary.

I gave up here and found that MacPorts have an installer.

Installed MacPorts alright, but when I tried to run the command:

sudo port install octave-devel +atlas+docs
It came up with the error not knowing what the command "port" was. I had to type in:
export PATH=/opt/local/bin:/opt/local/sbin:$PATH
One prerequisite is to have xcode installed.


Having done all this, still came up with an error:
Error: Port octave-devel not found

I think it's because we have a proxy server which looks like complicated to add to MacPorts!

Oh well, might just try Matlab! (student version £55!)


....... a little time later......

So I'm now trying at home on OS X 10.7.5

Installed MacPorts
trying to install octave but comes up with:
Error: Port octave not found
Turns out you have to selfupdate MacPort in order for it to sync something or other. Type:
sudo port -v selfupdate
This then came up with the error:
rsync: failed to connect to rsync.macports.org: Connection refused (61)
rsync error: error in socket IO (code 10) at /SourceCache/rsync/rsync-42/rsync/clientserver.c(105) [receiver=2.6.9]
Command failed: /usr/bin/rsync -rtzv --delete-after rsync://rsync.macports.org/release/tarballs/base.tar /opt/local/var/macports/sources/rsync.macports.org/release/tarballs
Exit code: 10
Error: /opt/local/bin/port: port selfupdate failed: Error synchronizing MacPorts sources: command execution failed
Doh! Just did a search and found this. Turns out I have PeerGuardian running. Turned it off and ran selfupdate again which worked fine. So, next I tried installing octave again:
sudo port install octave
--->  Computing dependencies for octave
Error: Dependency 'atlas' not found.
Doh! I read this article which tells how other people are having the same trouble. Looks like one of the sync files on a server must be wrong. selfupdating port at some point will fix it;
sudo port -v selfupdate
sudo port install octave +accelerate +gcc45
What do you know? It worked!!

Tuesday, 19 March 2013

Set Automatic Proxy Configuration through Command line in OS X 10.7

It took me a while to find it, but to set the Automatic Proxy Configuration url and tick the box through command line I found this helpful post which describes a script on how to do it.

First you need to find which network interface you want to change:

networksetup -listallnetworkservices
Ethernet

Use this in the command:
networksetup -setautoproxyurl Ethernet http://wpad.your.path.here/wpad.dat
By adding a url it automatically switches it on. To check:
networksetup -getautoproxyurl Ethernet
Simples. Don't know why it took me so long to find it. Don't think it's in the man page for networksetup for some reason!

Monday, 8 October 2012

Getting VirtualBox to use Bootcamp partitioned Windows XP on a Mac

So, I really wanted VirtualBox to use the Bootcamp partitioned windows XP. After a bit of trauling I found this but had a slight error "resource_busy" and found this with a reply sorting it out. Turns out you have to unmount the disk to create the .vmkd file.

  1. make a new machine
  2. when asked about disks, load up the terminal
  3. find the disk and partition with windows installed
    1. diskutil list
  4. unmount it
    1. I did this in disk utility
  5. change permissions on it
    1. chmod 777 /dev/diskXsY  (replace X and Y with numbers)
  6. go into the folder where your new VirtualBox machine is
    1. cd ~/VirtualBox\ VMs/VirtualComputerName
  7. make the .vmkd file
    1. sudo vboxmanage internalcommands createrawvmdk -rawdisk /dev/disk0 -filename "winXP.vmdk" -partitions 3
    2. you have to find out how many partitions are on the harddrive. I've got 3
  8. change permissions of the files created
    1. chmod 777 winXP*
  9. in VirtualBox, select the disk file you created.
Sorted.

Turns out the error I got was from not reading the bit where you have to unmount it.

Saturday, 21 July 2012

installing Trains and Zeppelin Mod for Minecraft

So, my son would like to play this "Trains and Zeppelin Mod" for minecraft. Talk about complicated! I've got a mac which adds a little more complication. Anyway, here's how to do it:

  1. go to terminal and type:
    1. cp ~/Library/Application\ Support/minecraft/bin/minecraft.jar ~/Library/Application\ Support/minecraft/bin/minecraft_backup1.jar
      1. this creates a backup of your .jar file
    2. mkdir ~/temp
      1. this makes a folder in your home folder called temp
    3. cd ~/temp
      1. this moves you into this folder
    4. jar xf ~/Library/Application\ Support/minecraft/bin/minecraft.jar
      1. this unzips the .jar file into the temp folder
  2. download:

    1. Modloader -> download file here
    2. ModloaderMp -> download file here
    3. Minecraft Forge API -> download file here
    4. Trains and Zeppelin Mod -> download file here
  3. unzip these zip files (double click on them)
  4. copy, in the order downloaded, all the contents of these zip files to the ~/temp/ folder on your home drive
    1. a dialogue box will appear saying something along the lines of:
      1. do you want to overwrite this file
    2. tick the "apply to all" box and click "replace"

  5. finally, go back to "Terminal" and type:
    1. jar uf ~/Library/Application\ Support/minecraft/bin/minecraft.jar ./
      1. this zips the temp folder up into the .jar file in the right location
When the game is now loaded, it will tell you down the bottom left that there are 4 mods, and it should all work.

I had a bit of trouble before, but I've found I did things a little different then suggested. Heres some things I did different:
  1. I loaded the game up after just installing the Modloader, ModloaderMp and Minecraft Forge API without the Trains mod installed.
    1. I then went through the process again, and added the Trains and Zeppelin Mod
  2. I didn't delete the META-INF folder in the .jar file
  3. I couldn't find the trainconfig.cfg file.
    1. turns out it is automatically made when minecraft is started.
    2. doesn't look like this file works on Mac OS X 10.6.8?!
    3. None of the Keys work!!!!!!
Hope it helps.

One note I'd like to make is:
  • Why is this such a long winded process. The way I would like to add Mods is to:
    • double click a file which loads and says it's installed!
But, I ask myself, why don't I do this. Well I guess I expect too much.

Wednesday, 25 April 2012

Rendering with Maya Terminal command line

So, want to start a render farm, which essentially sends command line commands to computers. You can do this yourself really.

I thought I'd document the command line stuff so that I can come back to it some other time.

So, to open the Maya Terminal, you can open up Terminal and type:
. /Applications/Autodesk/maya2012/Maya.app/Contents/bin/MayaENV.sh

Now you'll have access to Maya terminal commands.

Here's a simple line to render a file:
render /Users/me/test.mb

Simply renders the file with the settings that are set inside that file (in the render settings).

You can use flags with this command to set all kinds of things. Found a good help page here. The ones I'm interested in are:

  • -r mr
    • uses mental ray for renderer
  • -rd /Users/Shared
    • uses the specified directory for rendering to
  • -s 1
    • sets the start frame of sequence to render
  • -e 100
    • sets the end frame of sequence to render
  • -reg 0 250 0 250
    • sets the render region to render 
    • (left right bottom top)
    • it's key to note that co-ordinates 0, 0 are at the bottom left of the image, so 0 250 0 250 renders a 250px square at the bottom left as pictured
    • it creates a file of the proper resolution, and fills in the part which was rendered
    • to combine, make sure each render 'region' has a different file name, peice it back together in photoshop
  • -im mylovelyfile
    • saves the render with this name
  • -x 250
    • renders this amount of pixels width-ways
  • -y 250
    • renders this amount of pixels height-ways
  • -cam persp1
    • the name of the camera you want to render from
  • -proj /Users/Shared/
    • uses this folder to load file
  • -n 0
    • use all available processors
If you're using mentalray, you can also use:
  • -art
    • mentalray measures how many cores you have and adjusts to maximise performance
  • -v 5
    • for render percentage
For a render farm, each node will need access to the .mb file and all the textures. It's also good to have them render to the same folder so you don't have to collect it all. I'd have the files on the server and run this command:

(first make a directory to mount the shared folder onto)
mkdir /Volumes/renderfarm
(then mount it)
mount -t afp afp://admin:password@my.server.dns.name/MySharedFolder /Volumes/renderfarm

I'd also be tempted to load the file up from this mounted directory and make sure the project path corresponds to this, so it can find all the sub-directories for textures and such.

On each computer you simply type the range of files to be rendered, so:
render -r mr -s 1 -e 10 -rd /Volumes/renderfarm/rendered/ -v 5 -art /Volumes/renderfarm/file1.mb
render -r mr -s 11 -e 20 -rd /Volumes/renderfarm/rendered/ -v 5 -art /Volumes/renderfarm/file1.mb
render -r mr -s 21 -e 30 -rd /Volumes/renderfarm/rendered/ -v 5 -art /Volumes/renderfarm/file1.mb
render -r mr -s 31 -e 40 -rd /Volumes/renderfarm/rendered/ -v 5 -art /Volumes/renderfarm/file1.mb
render -r mr -s 41 -e 50 -rd /Volumes/renderfarm/rendered/ -v 5 -art /Volumes/renderfarm/file1.mb

Thursday, 19 April 2012

OS X Maya command line rendering with ssh

So, we have a lot of Apple Macs here, some very, very nice Mac Pro's. I have previously attempted to set up a render farm through X-Grid, which is managed through a Mac OS X Server.

I've just found Autodesk's Backburner is now available for mac, but I think it might not have an Administrator GUI for OS X, just Windows? I'll look into it. Anyway, found this little video on how to get a mac client working with backburner(submitting a job and using it as a render node)

But my original purpose in making this post was to catalogue how I'm going to use the command line to render (until I get backburner up and running).

So, I've installed Maya 2012 on a nice fast machine (not mine) and I want to render a job on this nice machine. So I open up terminal and type:

ssh 123.456.7.89
password....

. /Applications/Autodesk/maya2012/Maya.app/Contents/bin/MayaENV.sh
render /path/to/file.mb

The ". /Applications/Autodesk/maya2012/Maya.app/Contents/bin/MayaENV.sh" line loads up Maya Terminal.

It renders whatever you have set up in the file. i.e. I set up for it to render one frame from perspective camera at 1080p resolution on Production Quality to: /path/to/maya/project/folder/images/.

You can add more information via the 'render' command. Type:

render -h

to get a very long list of arguments for the render command.

Wednesday, 15 February 2012

iTunes Apps folder on OS X

So, I've been downloading a few new apps for the iPads and have just been notified that I'm using too much disk space. So, looking into where the apps are stored I found this folder:

~Music/iTunes/iTunes\ Media/Mobile\ Applications

Thought I'd move this to the local drive and make a symlink:

ln -s /Volumes/Scratch\ Disk/Stephen/Mobile\ Applications /Network/Servers/appleton.chesterfield.ac.uk/home2\$/LeachS/Music/iTunes/iTunes\ Media

Yep, still works. So all is good.

Monday, 12 December 2011

iTunes iPad backup location

I've noticed my Library folder get immensely large. I looked into it with OmnDiskSweeper (now that WhatSize has decided to charge) and found nearly 800MB (not much nowadays but too much for this as far as ICT Services goes) was taken up with iPad backups:

/Library/Application\ Support/MobileSync/Backup

I thought the easiest solution was to move it to the local scratch disk and symbolically link it. Heres the exact command I used to create the symbolic link:


ln -s /Volumes/Scratch\ Disk/Stephen/Library/Application\ Support/MobileSync/Backup /Network/Servers/appleton.chesterfield.ac.uk/home2\$/LeachS/Library/Application\ Support/MobileSync 

Seems to have done the trick.

I also noticed another folder taking up a lot of disk space whenever I tried to do a software update for the iPads:

/Volumes/Scratch\ Disk/Stephen/Library/iTunes/iPad Software Updates/

I decided to move the whole /Library/iTunes folder across. Here's the command I used to create a symbolic link:

ln -s /Volumes/Scratch\ Disk/Stephen/Library/iTunes /Network/Servers/appleton.chesterfield.ac.uk/home2\$/LeachS/Library

Monday, 21 November 2011

Making Symbolic links on Mac OS X through command line

So, I keep having to refer back to this, so instead of looking through old posts which mention it, I thought I'd make a post dedicated to Symbolic links.

So, to make a symbolic link it is simply:

ln -s /pathtoexistingfolder/ /pathtofolderyouwantsyboliclinkin/

Simple. Of course many occasions call for you to use the command line to check whether a folder is a symbolic link. To do this I use this command:

ls -l ~/Library/

If a folder in this list starts with an 'l' it means it is a symbolic link. I run this command to check whether the Caches folder is a symbolic link:

ls -l ~/Library/ | grep 'Caches'

What comes up if it is a symbolic link is:

lrwx------ 1 330986 wheel 19 Nov 21 11:37 Caches -> /tmp/330986/Caches/

Notice the "l" at the begining, and also the " -> " which then tells us where the symbolic link goes to.