Error: xcrun threw an error Error: Command failed

Appium ver - 1.3.3
Java-Client - 2.0
Testing iOS Real Device( iPhone4)

I am trying to run appium tests.
I am running it on VM which is running Yosemite, host is also Yosemite.

I am facing this issue. Here are the server logs

info: Welcome to Appium v1.3.3 (REV 34e21b01b87d4e3959e1c97c0a8d0b1a610bdc78)
info: Appium REST http interface listener started on 0.0.0.0:4723
info: Console LogLevel: debug
info: --> POST /wd/hub/session {“desiredCapabilities”:{“app”:“com.barnesandnoble.B-N-eReader”,“platformName”:“iOS”,“deviceName”:“ios”,“udid”:“998be1de418f0f57b1391cc58a79a74292525ef4”}}
info: Client User-Agent string: Apache-HttpClient/4.3.2 (java 1.5)
info: [debug] App is an iOS bundle, will attempt to run as pre-existing
info: [debug] Creating new appium session 54544e7b-0b50-4497-9176-97bdfe23e6fa
info: [debug] Removing any remaining instruments sockets
info: [debug] Cleaned up instruments socket /tmp/instruments_sock
info: [debug] Setting Xcode folder
info: [debug] Setting Xcode version
info: [debug] Setting iOS SDK Version
info: [debug] Getting sdk version from xcrun with a timeout
error: xcrun threw an error Error: Command failed:

Agreeing to the Xcode/iOS license requires admin privileges, please re-run as root via sudo.

error: Stderr:

Agreeing to the Xcode/iOS license requires admin privileges, please re-run as root via sudo.

error: Stdout:
info: [debug] Getting sdk version from xcrun with a timeout
error: xcrun threw an error Error: Command failed:

Agreeing to the Xcode/iOS license requires admin privileges, please re-run as root via sudo.

error: Stderr:

Agreeing to the Xcode/iOS license requires admin privileges, please re-run as root via sudo.

error: Stdout:
info: [debug] Getting sdk version from xcrun with a timeout
error: xcrun threw an error Error: Command failed:

Agreeing to the Xcode/iOS license requires admin privileges, please re-run as root via sudo.

error: Stderr:

Agreeing to the Xcode/iOS license requires admin privileges, please re-run as root via sudo.

error: Stdout:
error: Could not determine iOS SDK version
info: [debug] Cleaning up appium session
error: Failed to start an Appium session, err was: Error: xcrun threw an error Error: Command failed:

Agreeing to the Xcode/iOS license requires admin privileges, please re-run as root via sudo.

info: [debug] Error: xcrun threw an error Error: Command failed:

Agreeing to the Xcode/iOS license requires admin privileges, please re-run as root via sudo.

at /usr/local/avm/versions/1.3.3/node_modules/appium/lib/devices/ios/xcode.js:81:14
at ChildProcess.exithandler (child_process.js:652:7)
at ChildProcess.emit (events.js:98:17)
at maybeClose (child_process.js:756:16)
at Process.ChildProcess._handle.onexit (child_process.js:823:5)

info: [debug] Responding to client with error: {“status”:33,“value”:{“message”:“A new session could not be created. (Original error: xcrun threw an error Error: Command failed: \n\nAgreeing to the Xcode/iOS license requires admin privileges, please re-run as root via sudo.\n\n\n)”,“origValue”:“xcrun threw an error Error: Command failed: \n\nAgreeing to the Xcode/iOS license requires admin privileges, please re-run as root via sudo.\n\n\n”},“sessionId”:null}
info: <-- POST /wd/hub/session 500 1452.634 ms - 414

Please let me know if you need more information.

And what exactly is the problem. Is this a a known bug ?

Thanks

Sorry you can delete this post. I downloaded Xcode yesterday, but i still had to accept all terms and policies.

I hope it will work now.