# Launcher setup


<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->

The `connect` and extension transports drive your everyday browser, but
sometimes that’s exactly what you don’t want: an agent filling forms
shouldn’t see your banking session. `fastcdp-setup` creates an OS
launcher (“CDP Chrome”) that starts your installed Chrome with
`--remote-debugging-port` and its own profile directory, so you get a
separate Chrome that’s only logged in to the things you want automated,
ready for
[`CDP.remote()`](https://AnswerDotAI.github.io/fastcdp/core.html#cdp.remote).
On macOS it’s a real app bundle in `~/Applications`, on Linux a
`.desktop` entry, on Windows a Start Menu shortcut.

``` python
from fastcore.test import test_eq
```

------------------------------------------------------------------------

<a
href="https://github.com/AnswerDotAI/fastcdp/blob/main/fastcdp/setup.py#L17"
target="_blank" style="float:right; font-size:smaller">source</a>

### chrome_path

``` python
def chrome_path():
```

*Find the installed Chrome (or Chromium) executable*

Each platform builder takes explicit `chrome`, `port`, `profile`, and
`dest` paths, so they can be exercised anywhere;
[`main`](https://AnswerDotAI.github.io/fastcdp/setup.html#main) picks
the right one and the conventional destination for the OS.

The bundle is three files: a plist, a one-line launcher script, and the
icon. Building one into a temp dir shows the structure:

``` python
app = _mac_app(Path('/usr/bin/true'), 'CDP Chrome', 9223, Path('/tmp/prof'), Path('/tmp/fastcdp-test-apps'))
print((app/'Contents/MacOS/launch').read_text())
test_eq((app/'Contents/Resources/icon.icns').exists(), True)
```

A `.desktop` entry plus a `hicolor` icon is the whole story on Linux:

``` python
desk = _linux_app(Path('/usr/bin/true'), 'CDP Chrome', 9223, Path('/tmp/prof'), Path('/tmp/fastcdp-test-share'))
print(desk.read_text())
test_eq(desk.name, 'cdp-chrome.desktop')
```

Windows gets a Start Menu shortcut built by PowerShell’s `WScript.Shell`
COM object; the icon is copied next to the profile so the `.lnk` has a
stable path to point at.

------------------------------------------------------------------------

<a
href="https://github.com/AnswerDotAI/fastcdp/blob/main/fastcdp/setup.py#L92"
target="_blank" style="float:right; font-size:smaller">source</a>

### main

``` python
def main(
    port:int=9223, # Debug port (`CDP.remote`'s default; 9222 would clash with the everyday browser's built-in debugging)
    profile:str=None, # Chrome profile dir (default: `~/.cache/fastcdp/cdp-chrome`)
    name:str='CDP Chrome', # Launcher name
):
```

*Create an OS launcher for a debug-enabled Chrome with its own profile,
ready for
[`CDP.remote`](https://AnswerDotAI.github.io/fastcdp/core.html#cdp.remote)*

`fastcdp-setup` is registered as a console script, so after
`pip install fastcdp` it’s one command with sensible defaults. It shares
[`CDP.remote`](https://AnswerDotAI.github.io/fastcdp/core.html#cdp.remote)’s
default port 9223, so the pair works with no arguments on either side;
9222 is avoided because a main browser with built-in remote debugging
enabled already holds it.
