I didn't find any mentions of this in the other threads or a thread dedicated to this, but just wanted to point out that it is very easy to do this on a Mac.
You will need to follow the same instructions in the other guides, but you can do it all from the Mac OS Terminal easily and no need to install drivers, just like you would with Linux.
In case someone wants step by step instructions, here they are modified for Mac OS:
Original instructions by chuckhriczko http://forum.xda-developers.com/showthread.php?t=581577
Step 1:
First you need to download the Android SDK. You can get it from http://developer.android.com/sdk/index.html. Download the Mac OS version and remember where the android-sdk-mac folder is (most likely in your Downloads folder)
The next thing we download is asroot2. This is a script that was developed that runs an exploit in Android's linux that allows us to run root. The link for that is here: http://forum.xda-developers.com/attachment.php?attachmentid=244212&d=1257621154. Unzip that file and place it in a directory of your choice (I used android-sdk-mac/tools). Also download http://www.androidspin.com/downloads.php?dir=amon_ra/RECOVERY/&file=recovery-RA-heroc-v1.2.3.img and place that into the same directory you extracted asroot2.
Step 2:
Connect the phone to the USB port.
Open a terminal and cd into the directory that you extracted the sdk into. Then cd into the tools directory. Then run the following commands:
sudo ./adb push /directory_you_placed_asroot2/asroot2 /data/local/
sudo ./adb shell chmod 0755 /data/local/asroot2
sudo ./adb shell /data/local/asroot2 /system/bin/sh
mount -o remount,rw -t yaffs2 /dev/block/mtdblock3 /system
cd /system/bin
cat sh > su
chmod 4755 su
type exit until you are back to your Mac's prompt.
Now your phone is officially rooted! We arent done yet though. Now you need to flash the recovery image. If you are still in adb shell type in exit until you are out. You should be in the directory where you extracted the recovery image. If not go there. Type in the following:
sudo /.adb push recovery-RA-heroc-v1.2.3.img /sdcard/
Once that is done, type in sudo ./adb shell. If your command prompt is a dollar sign then type in su and press enter. If it is a pound sign you are good. Then type in the following:
flash_image recovery /sdcard/recovery-RA-heroc-v1.2.3.img
Once that is finished you are done. To reboot into recovery type in
sudo ./adb shell reboot recovery
If you are already in the shell, just type
reboot recovery
You should reboot into recovery mode and you can go from here. You can do a nandroid backup and then follow the other guides to install a different ROM or any other things you want to do.
If there are no instructions for Mac, just follow the Linux/Ubuntu instructions as they will be very similar if not the same.
Actually...
http://forum.xda-developers.com/showthread.php?t=581686
This is the thread I used to root my Hero CDMA from my Macbook, worked just fine...Thanks anyways for giving some love to macusers, guides are usually windows only.
I thought it was weird that there wasn't a Mac dedicated thread. I guess the search doesn't like 3 letter words.
What for SuperUser command does exists?
Is there a List?
How can i get the file from
/data/data/com.android.providers.settings/databases/settings.db ?
i used:
adb pull /data/data/com.android.providers.settings/databases/settings.db C:
but it says:
failed to copy '/data/data/com.android.providers.settings/databases/settings.db' to 'C:': Permission denied
any solution?
try typing
Code:
su
or if not try
Code:
adb remount
I dont know much about this stuff yet, but that could help
ilendemli said:
How can i get the file from
/data/data/com.android.providers.settings/databases/settings.db ?
i used:
adb pull /data/data/com.android.providers.settings/databases/settings.db C:
but it says:
failed to copy '/data/data/com.android.providers.settings/databases/settings.db' to 'C:': Permission denied
any solution?
Click to expand...
Click to collapse
are you rooted?
try:
Code:
adb shell "su -c 'cp /data/data/com.android.providers.settings/databases/settings.db /sdcard/'"
this will use su to copy it to the sdcard, then you should be able to pull it from there. Phone may pop up a "Superuser request". Be prepared to allow it.
when i type:
adb shell "su -c '/data/data/com.android.providers.settings/databases/settings.db /sdcard/'"
It says:
/data/data/com.android.providers.settings/databases/settings.db: permission denied
My Device is rooted, and i gave su permission
You forgot the "cp" between "su -c" and "/data/data/..."
C:\Users\ilendemli>adb shell "su -c '/data/data/com.android.providers.settings/databases/settings.db /sdcard/'"
/data/data/com.android.providers.settings/databases/settings.db: permission denied
C:\Users\Muhammet ilendemli>adb shell "su -c 'cp /data/data/com.android.provider
s.settings/databases/settings.db /sdcard/'"
cp: not found
My CMD Window, whats wrong?
Hum, that's strange.
Try this : (<Enter> means pressing the Enter key on your keyboard)
adb shell <Enter>
su <Enter> (here you may have to look at your phone to give him the autorisation it needs)
cp /data/data/com.android.providers.settings/databases/settings.db /sdcard/ <Enter>
If it says "cp: not found", try this line :
busybox cp /data/data/com.android.providers.settings/databases/settings.db /sdcard/ <Enter>
busybox: not found
Try to replace busybox by bb in the command I gave you.
If it doesn't work, well, I'll doubt you did your root well ^^ Cause it should have install BB
Can you explain us what you did to root your phone ?
I used SuperOneClick Root, to root my Phone. it installed the su files and superuser.apk nothing else
EdIT:
I installed busybox manually and rebootet my phone, now when i type:
>adb shell "busybox -c cp '/data/data/com.android.providers.settings/databases/settings.db /sdcard/'"
it says:
-c: applet not found
EDIT2:
>adb shell
$ busybox cp /data/data/com.android.providers.settings/databases/settings.db /sdcard/
busybox cp /data/data/com.android.providers.settings/databases/settings.db /sdcard/
cp: can't open '/data/data/com.android.providers.settings/databases/settings.db': Permission denied
$
That's normal, you missed the "su" command in your Edit 2.
So, 2 ways to do it.
Edit 1 version :
adb shell "su -c busybox cp '/data/data/com.android.providers.settings/databases/settings.db /sdcard/'"
Edit 2 version :
adb shell
su
busybox cp /data/data/com.android.providers.settings/databases/settings.db /sdcard/
And I thought SuperOneClick did install BB... Well, I thought wrong ^^
Edit 1 version: Didnt worked..
Edit 2 version: WORKED!? i have the database,
now, how can i give these command in java?
anything with exec("..
From adb, you can't execute Java methods (because you're not in a JVM).
And I don't think you can access the DB like that in fact.
You have to make an app that read/write/do what you want on the DB (and it seems you're doing so, refering to the other topic you made )
it's not allowed, to edit databases directly, so my app will copy the database somewhere else, edit it, and copy it back, then it should work.
€: and i don't want to edit databses from the adb, i cant do it, the program cant do it, but java can do it:
Code:
myDB.execSQL("DELETE FROM system WHERE name = 'name1';");
myDB.execSQL("DELETE FROM system WHERE name = 'name2';");
myDB.execSQL("INSERT INTO system (name, value) VALUES ('name1', '"+arr[0]+"');");
myDB.execSQL("INSERT INTO system (name, value) VALUES ('name2', '"+arr[1]+"');");
Yes it should.
Make sure you don't mess with the DB though. It's an easy thing to break
Edit : From adb, apparently you can do something like
sqlite3 settings.db
Then you'll have a DB prompt where you can write SQL commands like SELECT, INSERT, etc.
can busybox delete and replace files?
BB lets you use any Unix command.
So you can use (in your example) the mv command, which will move a file from a directory to another one.
Runtime.getRuntime().exec("busybox mv /sdcard/ /data/data/com.android.providers.settings/databases/settings.db");
this should work
E: Hmm, doesn't work..
E2: should look like this: Runtime.getRuntime().exec("busybox mv /sdcard/settings.db /data/data/com.android.providers.settings/databases/");
will try it.
Yes. But remember you have to be root to do that
Hi,
Just a little help for me please, I try to launch some adb command with SU
In my little head, I have think translate your code with the SU call before
Code:
adb shell uname -r
become
Code:
adb shell su uname -r
With the first command, all is good I have my answer, with the su first I have
Code:
Permission Denied
I have a DESIRE (bravo) rooted and S-OFF, what did I do wrong ?
The Linux su expects a user name as parameter, not a command. As far as I can see, the Android su simply ignores this parameter. If you want su to execute a command, use the -c option, like in
Code:
su -c uname -r
This causes su to execute "uname -r" as root, after that it returns immediately, so you're back at the user level you've been before. This might not be what you expect, but that's how it works.
Your permission error: Try a single su command, without any arguments or options. If it also returns a permission error, you're not rooted. It should ask you at the mobile's display for permission if you're rooted and you are doing that for the first time.
Thx U dude, U R the one
I have a MT4G and I'm using the Cyanogenmod rooting technique. I'm at the part where i'm pushing certain files to the /data/local path.
adb push psneuter /data/local/tmp/
adb push gfree /data/local/tmp/
adb push busybox /data/local/tmp/
adb push hboot-eng.img /data/local/tmp/
adb push root_psn /data/local/tmp/
adb push flash_image /data/local/tmp/
adb push su /sdcard/
adb push Superuser.apk /sdcard/
adb shell chmod 755 /data/local/tmp/*
When i get to "root_psn", I get the error that I cannot push due to being read only...I dont understand because this is the same path as the rest of the files, and I have no problem with them.
I don't want to go any further until I know what's going on.
Are you sure your not just running out of space on your data partition?
Gene Poole said:
Are you sure your not just running out of space on your data partition?
Click to expand...
Click to collapse
It was actually a mistake on my part. I was typing only /data/tmp for some reason...
Anyway, I moved on from there, having trouble here:
adb push su /sdcard/
failed to copy 'su' to /sdcard//su': permission denied
Same error goes for Superuser.apk, and once i get into the adb shell I get permission errors for /data/local/tmp/psneuter.
I didnt go any further than this. My phone is still fine, I also do NOT have visionary installed. I also got rid of the superuser app that was already on my phone.
Kind of stuck.
ugh, wtf. More trouble.
Moved passed the previous error, now i have a new one:
./gfree -f -b hboot-eng.img -y recovery.img
"Error opening backup file"
I tried the next step, then get the error saying how Superuser.spk and SU cannot be found. I placed them directly on the SD card via usb cable since I got the error of write protected SD card.
I'm trying to push some shared libraries to the /system/lib folder but this is what I get;
[email protected]:~/Downloads/openni_binary$ adb devices
List of devices attached
365426350c09263 device
[email protected]:~/Downloads/openni_binary$ adb shell
$ su
# mount -o remount rw /system
# exit
$ exit
[email protected]:~/Downloads/openni_binary$ adb push system/lib/libOpenNI.so /system/lib
failed to copy 'system/lib/libOpenNI.so' to '/system/lib/libOpenNI.so': Permission denied
how can I get acces to push files to that folder?
By the way: adb push=copy? can I copy .os files into the /system/lib folder using root explorer?
Thanks in advance
Sent from my A500 using XDA Premium HD app
N.Miranda said:
Well, I need to push some libraries via adb, but I can't remount the /system folder with rw permisions, it appear the next message
$mount -o remount rw /system
mount: Operation not allowed
Click to expand...
Click to collapse
Based on the prompt ($) that does not look like a root shell, a regular user is not allowed to do that. You must have root shell or use sudo.
N.Miranda said:
Should I have to create a new rule file to use the adb?
Click to expand...
Click to collapse
Based on what you have written you are already connected usign adb, so I don't really understand the question.
eppeP said:
Based on the prompt ($) that does not look like a root shell, a regular user is not allowed to do that. You must have root shell or use sudo.
Based on what you have written you are already connected usign adb, so I don't really understand the question.
Click to expand...
Click to collapse
ok this is my problem:
[email protected]:~/Downloads/openni_binary$ adb push system/lib/libOpenNI.so /system/lib
failed to copy 'system/lib/libOpenNI.so' to '/system/lib/libOpenNI.so': Permission denied
how can I set the /system folder to rw?
N.Miranda said:
ok this is my problem:
[email protected]iranda-HP-Mini-110-3700:~/Downloads/openni_binary$ adb push system/lib/libOpenNI.so /system/lib
failed to copy 'system/lib/libOpenNI.so' to '/system/lib/libOpenNI.so': Permission denied
how can I set the /system folder to rw?
Click to expand...
Click to collapse
It might help to know what rom you have installed..
It seems you either have a fully rooted rom where deliberately is not root by default (run 'adb root' then all subsequent adb commands will run as root until you reboot the tab)
Or (more likely as those instructions are likely in the op of any such rom) a rooted stock rom where adb can't be root because it was not unlocked in the ramdisk (except you can call su. Once you connect)
Regardless
run: adb root
If it is successful to push a file to system:
>run 'adb remount' to remount system to read write if its not already
>run 'adb push <local file> /system/<system file>
If it fails: we need to manually move it to system
>run 'adb push <local file> /data/local/tmp/<filename>'
>run 'adb shell's
>run 'mount -o remount,rw /system /system'
>run 'cat /data/local/tmp/<filename> > /system/<system file>'
>run 'rm /data/local/temporary/<filename>'
If busybox is installed busybox mv can be used to transfer the file to system rather than cat/rm.. busybox also has the cp command unlike true stock android. And the busybox mount will assume remount only needs a target and not a for show source as well.
It ought to be noted the adb commands are system independent.
SOLVED! I changed the permissions of the /system/lib folder with Root Explorer and then push the files using adb push ;-)
Sent from my A500 using XDA Premium HD app