A woman accused of harassing Apple CEO Tim Cook with pleas for sex and other crude suggestions before showing up at his Silicon Valley home in a threatening manner last October agreed to stay away from him for the next three years under an agreement approved Tuesday.

Julie Lee Choi consented to the deal negotiated with Apple during an appearance in Santa Clara County Superior Court. Cook, Apple's CEO for the past decade, wasn't present at the proceeding held in San Jose, California.

Choi, 45, declined to comment after the hearing while angrily waving off two reporters taking her picture outside the courthouse. An Apple lawyer also declined to discuss the stipulation.

The court order requires Choi to refrain from coming within 200 yards of Cook during the next three years and prohibits her from attempting to communicate with him through any electronic means, including on Twitter accounts or emails. If she violates the terms, Choi could face criminal charges and potentially imprisoned.

The bizarre case traces back to late 2020 when Choi began emailing Cook begging him to have sex with her and attaching images of handguns that she insisted he had made her buy, according to evidence that Apple submitted to obtain a temporary restraining order against her in January. Those documents also revealed Choi had set up a series of bogus companies trying to connect her to Cook, sometimes listing an Apple office as the headquarters.

“I can't live like this anymore," Choi wrote in one email to Cook sent from an iPhone. “I want sex with you, please, please."

Cook has publicly said he is a gay man, but even after Choi acknowledges knowing that her entreaties to him continued. “Tim, if we are destined for our lives, any circumstance we can meet each other," Choi wrote in a December email that also told him where she was staying in San Jose at that time.

Apple took legal action after Choi told him last September that she intended to apply to become his “roommate” at his condominium located in Palo Alto, California — about 15 miles from Apple's headquarters in Cupertino, California.

In October, Choi showed up outside Cook's home on two separate actions and warned she “could get violent," according to court documents.

Then, in another December email, Choi told Cook she would forgive him for $500 million in cash.

A few weeks after that, Apple sought its temporary restraining order in a request that contended Choi “may be armed" and “intends to return to Apple's CEO residence or locate him otherwise in the near future." Choi had been living in McLean, Virginia before she began shadowing Cook in Silicon Valley.

Apple paid more than $630,000 for security measures designed to protect Cook last year, according to a required company disclosure to shareholders.