remove main menu sub menu

i have a menu in my main menu (for example the file menu) how would i remove it programaticly? i found the removeItem: method but that doesn’t seem to work.

Try something like this:

delete menu item "test" of main menu

wow, too easy. Works great, thanks.